4.  Validate your input to prevent accepting garbage in completely in your 
service.  That's separate from logging or not.

1a. Make your logging do something like how networking does exponential 
backoff so you get 'some' indications but if things run really amok you 
don't flood your logs.   Log it if you see N messages.   Back off til you 
see N*2, then N*4, etc. unless you have some definable quiet period to let 
logging reset its settings.   Easier said than done I guess :-)

5. Use cron or logwatch or equivalent to look for those messages in your 
syslog and perhaps trigger some command to tell your service to back off on 
its logging.

On Friday, April 7, 2023 at 1:56:16 PM UTC-7 [email protected] wrote:

> Suppose a WeeWX service is augmenting loop packets. After some time 
> passes, it starts to receive bad data, logs this information, and ignores 
> the bad data. If the service continues to receive bad data it will ‘flood’ 
> the log with these error messages. I see a few possible ways to stop this.
>
>    1. Throttle the logging. For example, after X errors only log every 
>    Nth message.
>    2. Have the service shut itself down. This would probably require 
>    accessing the engine’s internal callbacks data structure or an enhancement 
>    to allow ‘unbinding’ to events.
>    3. Raise an exception, causing WeeWX to terminate.
>    At first glance 3 seems a bit severe. But if this data is critical, it 
>    could make sense to stop WeeWX. Option 2 intrigues me if the problem is 
> due 
>    to the computer being stressed (CPU, RAM, network, etc.). Stopping the 
>    service might help determine if the service is the cause or not. Option 1 
>    seems the simplest and leaves the possibility that good data will start 
>    arriving and everything will ‘self correct’ and is the option I am leaning 
>    towards.
>
> Thoughts?
> Thanks. - rich
>

-- 
You received this message because you are subscribed to the Google Groups 
"weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-development/a88884c3-fcd7-4981-8edb-1b7fa91aaaf7n%40googlegroups.com.

Reply via email to