Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit error reporting when repeater is offline #44

Closed
johnhays opened this issue Feb 27, 2024 · 6 comments
Closed

Limit error reporting when repeater is offline #44

johnhays opened this issue Feb 27, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@johnhays
Copy link

When an Icom repeater / controller is switched off, the log fills with reports, for example:

[2024-02-27 06:08:49] [ERROR ] Error returned from sendto (port: 20000), err: Network is unreachable
[2024-02-27 06:08:49] [ERROR ] Error returned from sendto (port: 20000), err: Network is unreachable
[2024-02-27 06:08:50] [ERROR ] Error returned from sendto (port: 20000), err: Network is unreachable
[2024-02-27 06:08:50] [ERROR ] Error returned from sendto (port: 20000), err: Network is unreachable

Please add code to limit the number of reports for a given incident (5?) and maybe make it a configuration parameter.

This can build very large log files in a short period of time.

@F4FXL F4FXL added the enhancement New feature or request label Feb 28, 2024
@F4FXL
Copy link
Owner

F4FXL commented Feb 28, 2024

The trick is to find d a way to buffer log information while not making the log lag behind the actual event....

any chances I get access to your system for testing purposes?

@johnhays
Copy link
Author

I can set you up for that, but I think you would need me available to start and stop the repeater(s) - I am not available for a couple of days though.

Here is some psuedo code -- locate the line that is creating this log message.

IF (messagecount < 5) THEN
LogError(Network is unreachable)
ELSIF (Timer > 60 minutes) THEN
LogError(Network is unreachable)
ResetTimer(0 minutes)
ResetCounter(0)
ELSE
IncrementTimer
ENDIF

This should limit error messages from this sendto to 5 per hour.

@F4FXL
Copy link
Owner

F4FXL commented Feb 28, 2024

I will take this opportunity to add some behaviro driven testing to the logging stuff, thus I might only need you to test the branch on your actual system once it is done.

@F4FXL
Copy link
Owner

F4FXL commented Feb 28, 2024

I took a more general approach, the logs compares any incoming message with the previous one.
As long as the messages are identical (apart) from timestamp they are ignored and counter is incremented. As soon as another message arrives counter is reseted and an aditional message is generated.

Output looks like this:

[2024-02-28 19:50:46] [ERROR  ] One Message
[2024-02-28 19:50:46] [ERROR  ] Previous message repeated 8 times
[2024-02-28 19:50:46] [ERROR  ] Another Message

The first message has been fired 9 times in total.

F4FXL added a commit that referenced this issue Feb 28, 2024
F4FXL added a commit that referenced this issue Feb 28, 2024
F4FXL added a commit that referenced this issue Feb 28, 2024
F4FXL added a commit that referenced this issue Feb 28, 2024
@F4FXL
Copy link
Owner

F4FXL commented Feb 28, 2024

Branch feature/LimitLog_#44 is ready for testing

F4FXL added a commit that referenced this issue Feb 28, 2024
F4FXL added a commit that referenced this issue Feb 28, 2024
F4FXL added a commit that referenced this issue Feb 28, 2024
F4FXL added a commit that referenced this issue Feb 29, 2024
F4FXL added a commit that referenced this issue Mar 3, 2024
F4FXL added a commit that referenced this issue Mar 3, 2024
F4FXL added a commit that referenced this issue Mar 3, 2024
F4FXL added a commit that referenced this issue Mar 3, 2024
@F4FXL
Copy link
Owner

F4FXL commented Mar 3, 2024

@johnhays
IMHO it is pretty much done. Added an option into the config file log section. Yet the default setting should be fine.

repeatThreshold=#defaults to 2, valid values are disbaled and 1 to 10. Prevents flooding of logs from repeated log messages.

@F4FXL F4FXL closed this as completed in 38ff68f Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants