You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently experiencing a strange phenomena where one of my modbus devices "automatically" turns itself on. To investigate this further, my idea was to set the logging level in mbusd so that I can see what is sent to the device and when.
I discovered that up lo loglevel 4 sending does not create any log entries, in level 5 it begins to log the request but also very much information that I don't need like all read requests (which happen every 5 seconds) and lots of entries regarding the connection state, so there is very much data written. Logging the response needs an even higher loglevel.
This is currently logged for every command I send (21 lines):
05 Mar 2021 18:12:35 conn_open(): accepting connection from 192.168.40.39
05 Mar 2021 18:12:35 queue_new_elem(): length now is 1
05 Mar 2021 18:12:35 conn[192.168.40.39]: state now is CONN_HEADER
05 Mar 2021 18:12:35 conn[192.168.40.39]: state now is CONN_RQST_FUNC
05 Mar 2021 18:12:35 conn[192.168.40.39]: state now is CONN_RQST_TAIL
05 Mar 2021 18:12:35 conn[192.168.40.39]: request: [f7][06][00][64][00][00]
05 Mar 2021 18:12:35 conn[192.168.40.39]: state now is CONN_TTY
05 Mar 2021 18:12:35 tty: state now is TTY_RQST
05 Mar 2021 18:12:35 tty: state now is TTY_RESP
05 Mar 2021 18:12:35 tty: estimated 8 bytes, waiting 308332 usec
05 Mar 2021 18:12:35 tty: rx offset is 0
05 Mar 2021 18:12:35 tty: read 8 bytes of 8, offset 0
05 Mar 2021 18:12:35 tty: state now is TTY_PROC
05 Mar 2021 18:12:35 tty: response read (total 8 bytes, offset 0 bytes)
05 Mar 2021 18:12:35 tty: response is correct
05 Mar 2021 18:12:35 conn[192.168.40.39]: state now is CONN_RESP
05 Mar 2021 18:12:35 tty: state now is TTY_PAUSE
05 Mar 2021 18:12:35 conn[192.168.40.39]: state now is CONN_HEADER
05 Mar 2021 18:12:35 conn_close(): closing connection from 192.168.40.39
05 Mar 2021 18:12:35 queue_delete_elem(): length now is 0
05 Mar 2021 18:12:36 tty: state now is TTY_READY
This would be the information I'd like to log:
05 Mar 2021 18:12:35 conn[192.168.40.39]: request: [f7][06][00][64][00][00]
05 Mar 2021 18:12:35 conn[192.168.40.39]: response: [f7][06][00][64][00][00][dc][83]
Is there a possibility to achieve a log like this without generating tens of thousands of lines of logs?
The text was updated successfully, but these errors were encountered:
eikowagenknecht
changed the title
(Question) How to log values sent?
(Question) How to (only) log values sent?
Mar 5, 2021
Right now mbusd doesn't have an option to log request/responses only, but you could use -L- option to enable logging to stdout and then use filtering. Something like this:
I'm currently experiencing a strange phenomena where one of my modbus devices "automatically" turns itself on. To investigate this further, my idea was to set the logging level in mbusd so that I can see what is sent to the device and when.
I discovered that up lo loglevel 4 sending does not create any log entries, in level 5 it begins to log the request but also very much information that I don't need like all read requests (which happen every 5 seconds) and lots of entries regarding the connection state, so there is very much data written. Logging the response needs an even higher loglevel.
This is currently logged for every command I send (21 lines):
This would be the information I'd like to log:
Is there a possibility to achieve a log like this without generating tens of thousands of lines of logs?
The text was updated successfully, but these errors were encountered: