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

Dealing with timezones? #180

Open
MattSurabian opened this issue Feb 5, 2015 · 7 comments
Open

Dealing with timezones? #180

MattSurabian opened this issue Feb 5, 2015 · 7 comments

Comments

@MattSurabian
Copy link

I'm using this gem to analyze some S3 logs where the timestamps are UTC. It doesn't look like there is any option available to convert these to a specific timezone before generating the report.

I guess the biggest issue here aside from how gross working with timezones can be is that we need to tell the program what the current timezone in the log is before even thinking about trying to convert it to a different specific one. Bleh.

Any thoughts on how to best address this?

@wvanbergen
Copy link
Owner

The tricky part is that there's two timezones at play:

  • The timezone of the timestamps in the logs. In many cases, this includes a timezone but this is not always the case. So we'd need a command line argument for this. I don't like forcing people to set this, so it should have a default value. We could default to UTC if this command line option is not provided, although this could easily be incorrect.
  • The output timezone. This would require a command line option as well, which will also need a default. We could default to either: input timezone, local timezone (often UTC on servers). Whatever timezone we end up using, it should be included in the report.

THis is quite hairy but could be done. @barttenbrinke any thoughts?

@MattSurabian
Copy link
Author

I'm definitely in agreement that this should not be a required CLI parameter. Regarding default behavior, it might make more sense to completely ignore the timezone issue completely and simply report what's in the logfile as it does now in the event that no information is provided by the user at runtime.

The param would have to take two values logtimeZone and reportTimeZone maybe something of the form: ---timezone UTC:EST ?

Thanks for opening up this discussion, I know this is likely to be a whole thing.

@barttenbrinke
Copy link
Collaborator

How does the S3 timestamp look? Does it have any timezone info? Because the user friendly thing to do would be to 'auto detect' the source timezone (or fallback to UTC if we have no clue) and to output using the local machine's timezone.

@MattSurabian
Copy link
Author

The timestamp in my S3 logs is formatted like this:

[05/Feb/2015:14:49:24 +0000]

@MattSurabian
Copy link
Author

Regarding the local machine's timezone I think that's a reasonable default provided there's still a command line option override since it's not necessarily true that the majority of a services users live in the same time zone as the log analyzer.

@wvanbergen
Copy link
Owner

Does the standard library have enough timezone support to do this? Or would we need to introduce a runtime dependency for this?

@MattSurabian
Copy link
Author

I'd guess you'd want to include a dependency just to avoid having to implement DST aware transformations and the gross complexity that adds, as I don't think the standard library is capable of that on its own.

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

3 participants