feat: consistent logs
logging is somewhat inconsistent throughout the code, working to make things more consistent
log messages to be prefixed with:
WebSSH2 (<express session id>/<socket.io session id>) (<type>): <message>
Example:
WebSSH2 (48C6PpHh4efNC2nK9S8BhM8xA8tGLTq8/ZN5nZc2gsZEBQTVFAAAF) AUDIT: LOGIN user=root from=127.0.0.1 host=192.168.0.1:22
Debug messages planned to follow similar format
WebSSH2 (DUN2aRdg2k7zLWMrQfPR3iWs3sNOVWZI/dAnsjbLTgOakVC2UAAAB) SOCKET DISCONNECTING: server namespace disconnect +0ms
WebSSH2 (DUN2aRdg2k7zLWMrQfPR3iWs3sNOVWZI/dAnsjbLTgOakVC2UAAAB) CONN END BY HOST +0ms
WebSSH2 (DUN2aRdg2k7zLWMrQfPR3iWs3sNOVWZI/dAnsjbLTgOakVC2UAAAB) CONN CLOSE +0ms
reworked client js to generate reauth control message to signify termination in order to support a "LOGOUT" log event.
Client: https://github.com/billchurch/webssh2/blob/50cfcb97788cbd3409b4605adceef3d47e370e38/app/client/src/js/index.ts#L63-L68
Server: https://github.com/billchurch/webssh2/blob/50cfcb97788cbd3409b4605adceef3d47e370e38/app/server/socket.js#L172-L184
Addition of login variable to track the state of the users login. Mostly to prevent multiple LOGOUT log entries as a "logout" can come from different events depending on how the session is terminated.
https://github.com/billchurch/webssh2/blob/78dafebb2b1ba8b7a15ed57d615ef635384e2cf3/app/server/socket.js#L77
https://github.com/billchurch/webssh2/blob/78dafebb2b1ba8b7a15ed57d615ef635384e2cf3/app/server/socket.js#L84-L92
https://github.com/billchurch/webssh2/blob/78dafebb2b1ba8b7a15ed57d615ef635384e2cf3/app/server/socket.js#L116-L125
https://github.com/billchurch/webssh2/blob/78dafebb2b1ba8b7a15ed57d615ef635384e2cf3/app/server/socket.js#L169-L177
https://github.com/billchurch/webssh2/blob/78dafebb2b1ba8b7a15ed57d615ef635384e2cf3/app/server/socket.js#L190-L203
While, I have the logging "consistent" for the messages that are output. It's maybe not industry standard of any sort.
Feedback welcome for the format... For reference: https://www.graylog.org/post/log-formats-a-complete-guide