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 the possibility to log in UTC #22

Closed
ioggstream opened this issue Aug 24, 2018 · 5 comments
Closed

Add the possibility to log in UTC #22

ioggstream opened this issue Aug 24, 2018 · 5 comments

Comments

@ioggstream
Copy link

I wish

to configure the logger to use UTC, eg 2018-08-24T11:06:30.831710Z`

notes

a datetime object can be converted via:

d.utcnow().isoformat() + "Z"
@jobec
Copy link
Owner

jobec commented Aug 24, 2018

Maybe a stupid question, but do you want the current time to be used as if it were UTC? Or convert the current time in UTC?

What use case do you have in mind for this? Logging from a lot of sources in different timezones to a central destination?

One workaround could be to change your server's timezone to UTC, but that's maybe not an option for other reasons.

@ioggstream
Copy link
Author

Hi @jobec and thanks for your reply!

  • the time should be converted in UTC. The unix timestamp of the date should be preserved ;)

  • ensuring application logs are consistent even if I don't have control of the servers (eg. kubernetes, openshift, ..)

  • server time in UTC is the best choice, but I can't always access servers. I control the application though

Feel free to ask further questions.

@jobec
Copy link
Owner

jobec commented Sep 19, 2018

This was implemented in 26a4cdb

Could you test and let me know if it works as expected?

@jobec
Copy link
Owner

jobec commented Sep 21, 2018

It's now also available in v1.2.1

https://pypi.org/project/rfc5424-logging-handler/1.2.1/

@ioggstream
Copy link
Author

I'm adding the lib to a couple of apps but still didn't finish. I'll ping you as soon as I'm done.

Thanks a lot in the meantime!
R

@jobec jobec closed this as completed Oct 9, 2018
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

No branches or pull requests

2 participants