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

Glog file separation by year #516

Closed
vctang opened this issue Jan 13, 2020 · 5 comments
Closed

Glog file separation by year #516

vctang opened this issue Jan 13, 2020 · 5 comments

Comments

@vctang
Copy link

vctang commented Jan 13, 2020

Hello! There seems to be an edge case that occurs when the year switches while we are in the midst of writing glogs.

For instance, if we are writing glogs at 11:59 pm on 12/31/2019, and the year switches to 2020, the mmdd timestamp written on each line of the glog will not capture this year difference. Therefore, it looks like the glogs jump from 12/31/2019 to 01/01/2019 if we are only extrapolating the year from the file name, or the file creation date written at the top of each glog file.

I think some possible solutions include:

  • Appending the year to each glog line in the format of [IWEF]yyyymmdd hh:mm:ss.uuuuuu threadid file:line] msg
  • Splitting the glog file when the year changes.

Was there a reason for not including the year in the line-by-line output format?

aesophor added a commit to aesophor/glog that referenced this issue Mar 8, 2020
This PR fixes issue google#516 by prepending the year to each glog line.

Previous format of each line in a log file:
[IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg

New format:
[IWEF]yyyymmdd hh:mm:ss.uuuuuu threadid file:line] msg
@aesophor
Copy link
Contributor

aesophor commented Mar 8, 2020

@vctang I've opened a PR (#530) for this.

sergiud pushed a commit that referenced this issue Mar 25, 2020
* Prepend the year to each glog line (#516)

This PR fixes issue #516 by prepending the year to each glog line.

Previous format of each line in a log file:
[IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg

New format:
[IWEF]yyyymmdd hh:mm:ss.uuuuuu threadid file:line] msg

* Fix logging_unittest for PR #530

Since the format of each glog line has been changed,
the logging_unittest must also be updated.
@sergiud
Copy link
Collaborator

sergiud commented Mar 25, 2020

Fixed in #530.

@gpshead
Copy link

gpshead commented May 11, 2020

FWIW I think doing this was a mistake. It changes the log line format and is no longer compatible with Google's internal log line format.

Processes are never intended to be running for more than a year anywhere (regular software and infrastructure updates being a thing).

Anything parsing log lines should not blindly assume "current year" when parsing a line.

scottlamb added a commit to scottlamb/mylog that referenced this issue Mar 9, 2021
Include a : separator in the time, and include the year to match
a recent glog change:
google/glog#516
@sergiud sergiud mentioned this issue May 6, 2021
@cnsgsz
Copy link

cnsgsz commented Aug 10, 2022

Agree with @gpshead . Adding year seems to have broken GKE's built-in regex-based parsing for glogs.

@sergiud
Copy link
Collaborator

sergiud commented Aug 10, 2022

@cnsgsz Could you please create a new issue? The year prefix could be made optional.

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

5 participants