Hi! Before systemd we also had a problem where a script has sent 300000 error messages, breaking the local email clients so that the users could not delete the messages by themselves, but required an admin to run some script on the server... 8-(
So obviously some step between error an mail message is needed. Long ago I had invented a system that would assign some "error ID" to a problem, and then send a notification only if none had been sent for the same error recently. First time I saw such system was in ntpd's PARSE driver when the clock state changes frequently. The comment in refclock_parse.c says: /**=========================================================================== ** error message regression handling ** ** there are quite a few errors that can occur in rapid succession such as ** noisy input data or no data at all. in order to reduce the amount of ** syslog messages in such case, we are using a backoff algorithm. We limit ** the number of error messages of a certain class to 1 per time unit. if a ** configurable number of messages is displayed that way, we move on to the ** next time unit / count for that class. a count of messages that have been ** suppressed is held and displayed whenever a corresponding message is ** displayed. the time units for a message class will also be displayed. ** whenever an error condition clears we reset the error message state, ** thus we would still generate much output on pathological conditions ** where the system oscillates between OK and NOT OK states. coping ** with that condition is currently considered too complicated. **/ --- So you're inspired now 😉 Kind regards, Ulrich Windl > -----Original Message----- > From: systemd-devel <[email protected]> On > Behalf Of Felix E. Klee > Sent: Monday, July 20, 2026 2:04 PM > To: [email protected] > Subject: [EXT] [systemd-devel] Safe way to get email on failed service > > Using a toplevel override, I set up email notification on service fail: > > # /etc/systemd/system/service.d/toplevel-override.conf > [Unit] > OnFailure=failure-notification@%n > > Now, every time a service fails to start, I get an email, on every > single restart attempt. This can result in many emails. In fact, if > `StartLimitBurst` is not set, I would get mailbombed by my server. > > Therefore, I am thinking about a different solution that does not have > the mailbomb risk: A timer that sends an email if there is a failed > service. Having the timer trigger every hour would be sufficient. It > certainly would be better than getting no notification at all. > > *Am I reinventing the wheel? Isn’t there already something that solves > the problem?*
