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

Adding timestamp to stderr logging #759

Open
sgaragan opened this issue Feb 27, 2024 · 7 comments
Open

Adding timestamp to stderr logging #759

sgaragan opened this issue Feb 27, 2024 · 7 comments
Assignees

Comments

@sgaragan
Copy link

Description
When deploying pmacct on Kubernetes, logging is configured to be sent to stderr which is the standard logging model for a K8s deployment. However, the log messages do not seem to have any timestamps so there is no way to know when an issue occurred. For the log messages sent to syslog or a specific log file, timestamps are included with those messages (in syslog via the vsyslog function, log file has timestamps explicitly added to the output message)

Version
1.7.10

@job
Copy link
Member

job commented Feb 27, 2024

Pipe the proces output into ts or logger?

@paololucente
Copy link
Member

Hi Sean ( @sgaragan ), in addition to the suggestion from the great @job i have passed a patch to uniform the output of stderr and logfile, hence including a timestamp in the stderr output. Tested it, it seems to work fine, please give it a try yourself (see commit above). I have also added a piece of documentation for people upgrading since this will break any script parsing stderr output. Paolo

@job
Copy link
Member

job commented Feb 29, 2024

@paololucente is that enabled by default? I'm not sure timestamping should be enabled by default, as it breaks with conventions

@paololucente
Copy link
Member

I made it new default but, sure, i could totally make it optional and save backward compatibility. Let me go in this direction.

@sgaragan
Copy link
Author

Hi Sean ( @sgaragan ), in addition to the suggestion from the great @job i have passed a patch to uniform the output of stderr and logfile, hence including a timestamp in the stderr output. Tested it, it seems to work fine, please give it a try yourself (see commit above). I have also added a piece of documentation for people upgrading since this will break any script parsing stderr output. Paolo

Thanks Paolo, I will look at getting it redeployed when the change goes in with the optional config (which I agree makes sense, if making it a default will break backward compatibility)

@paololucente
Copy link
Member

Hi Sean ( @sgaragan ), Job ( @job ), this is now done. The config knob to enable timestamp when logging on stderr is log_stderr_tstamp, by default false. It should be set to true in the config, ie. : log_stderr_tstamp: true to enable the feature. Will also review documentation soon. Paolo

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

No branches or pull requests

3 participants