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

Add syslog logger implementation #2292

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ranma
Copy link
Contributor

@ranma ranma commented Sep 21, 2024

This implements RFC5424 version of the protocol.

See #1819

I didn't use https://github.com/arcao/Syslog since the protocol itself is trivial and most of the libraries functionality is not needed here. The library also doesn't support setting the PROCID field, which is set to a random id to indicate a reboot here.

2024-09-15T12:41:21.466816+02:00 OpenDTU-347AF0 OpenDTU[e4975f6a] [SyslogLogger] Logging to 192.168.8.240
2024-09-15T12:41:21.466816+02:00 OpenDTU-347AF0 OpenDTU[e4975f6a] WiFi got ip: 192.168.8.242
2024-09-15T12:41:21.474350+02:00 OpenDTU-347AF0 OpenDTU[e4975f6a] Network connected
2024-09-15T12:41:26.618582+02:00 OpenDTU-347AF0 OpenDTU[e4975f6a] Websocket: [/livedata][1] connect
2024-09-15T12:41:30.963775+02:00 OpenDTU-347AF0 OpenDTU[e4975f6a] Admin AP remaining seconds: 10 / 180
2024-09-15T12:41:40.977250+02:00 OpenDTU-347AF0 OpenDTU[e4975f6a] Admin AP remaining seconds: 20 / 180
2024-09-15T12:41:50.985588+02:00 OpenDTU-347AF0 OpenDTU[e4975f6a] Admin AP remaining seconds: 30 / 180
2024-09-15T12:42:00.999822+02:00 OpenDTU-347AF0 OpenDTU[e4975f6a] Admin AP remaining seconds: 40 / 180
2024-09-15T12:42:11.007716+02:00 OpenDTU-347AF0 OpenDTU[e4975f6a] Admin AP remaining seconds: 50 / 180
2024-09-15T12:42:11.575805+02:00 OpenDTU-347AF0 OpenDTU[e4975f6a] Websocket: [/livedata][1] disconnect
[...restarting from web UI, TASKID changes to indicate restart...]
2024-09-15T12:42:18.684665+02:00 OpenDTU-347AF0 OpenDTU[306b82ba] [SyslogLogger] Logging to 192.168.8.240
2024-09-15T12:42:18.684963+02:00 OpenDTU-347AF0 OpenDTU[306b82ba] WiFi got ip: 192.168.8.242
2024-09-15T12:42:18.685450+02:00 OpenDTU-347AF0 OpenDTU[306b82ba] Network connected
2024-09-15T12:42:28.188873+02:00 OpenDTU-347AF0 OpenDTU[306b82ba] Admin AP remaining seconds: 10 / 180
2024-09-15T12:42:38.199718+02:00 OpenDTU-347AF0 OpenDTU[306b82ba] Admin AP remaining seconds: 20 / 180
2024-09-15T12:42:48.210778+02:00 OpenDTU-347AF0 OpenDTU[306b82ba] Admin AP remaining seconds: 30 / 180
2024-09-15T12:42:58.221810+02:00 OpenDTU-347AF0 OpenDTU[306b82ba] Admin AP remaining seconds: 40 / 180

image

image

@stefan123t
Copy link

@khschmidt in #2278 has successfully built and used this PR to configure his OpenDTU using remote syslog.

@tbnobody would you want to merge this into master or are there some objections from the project side ?

ranma and others added 2 commits October 6, 2024 16:56
This implements RFC5424 version of the protocol.

Doesn't use https://github.com/arcao/Syslog since the protocol itself
is trivial and most of the libraries functionality is not needed here.
The library also doesn't support setting the PROCID field, which is set
to a random id to indicate a reboot here.

Adds UI for syslog configuration to network admin view.
* avoid duplicate id for hostname input
* hide server and port inputs if syslog disabled
@ranma
Copy link
Contributor Author

ranma commented Oct 6, 2024

Updated to match the version that was committed into OpenDTU-OnBattery:

@broth-itk
Copy link
Contributor

I am running this patch since 2 weeks now and OpenDTU creates 20MB logs per day (three inverters).
It works very well and the logs are actually quite useful.

@stefan123t
Copy link

Adding ESP-IDF Logging framework might be a way to filter log file generation in Serial, Web Console and Syslog #2361

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants