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

LineLogger NewLineBuf timestamp format #19

Closed
mattaezell opened this issue Jan 30, 2018 · 10 comments
Closed

LineLogger NewLineBuf timestamp format #19

mattaezell opened this issue Jan 30, 2018 · 10 comments
Labels

Comments

@mattaezell
Copy link
Contributor

https://github.com/chenglch/goconserver/blob/4415be43710a8eafaa940300b79d4fe4ed8af92b/console/pipeline/logger.go#L26

Many systems use milliseconds (elasticsearch), microseconds, or nanoseconds; but 5 zeros is very uncommon. Consider moving this to 3 or 6. Better yet, allow the format to be customized in the config file.

chenglch added a commit that referenced this issue Jan 31, 2018
This commit add time_precision option under console section
to help customize the `date` attribute in the console log
for tcp and udp logger.

Fix-bug: #19
@chenglch
Copy link
Contributor

chenglch commented Feb 1, 2018

@mattaezell , A new build has been uploaded to fix these issues, you could download it from https://github.com/chenglch/goconserver/releases/tag/v0.2.1 .

A new option has been added to help customize the time precision, the default value is microsecond.

console:
  # log the timestamp.
  log_timestamp: true
  # time precison for tcp or udp logger, precison for file logger is always second.
  # Valid options: second, millisecond, microsecond, nanosecond
  time_precision: microsecond

@mattaezell
Copy link
Contributor Author

Confirmed.
2018-02-01 20:04:22.777 h41n02 hello
Thanks!

@mattaezell
Copy link
Contributor Author

Sorry: now that I've had a bit more time to look into this I might need to request a slightly different format. It seems that many programs use ISO 8601 with a T character instead of a space between the date and time. Times also usually include a timezone (Z for UTC or +05:00 for another zone).

We plan to push consoles directly into ElasticSearch and evaluate them using sec

ElasticSearch uses strict_date_optional_time||epoch_millis by default
joda-time is the definition that ElasticSearch uses

@chenglch chenglch removed the pending label Feb 2, 2018
@robin2008
Copy link
Member

@mattaezell Do you mean ISO 8601 format is required for timestamp in log?

@mattaezell
Copy link
Contributor Author

@robin2008 At this stage, I'm not sure I could list it as a hard "requirement" (since I can convert formats), but it would certainly make integration with other products easier.

chenglch added a commit that referenced this issue Feb 2, 2018
This commit change all of the time format into RFC8601 format
to make it easier to integrate with other tools.

partial-issue: #19
@chenglch
Copy link
Contributor

chenglch commented Feb 2, 2018

@mattaezell , thanks for your advice, a new build to fix this has been uploaded inside the release link https://github.com/chenglch/goconserver/releases/tag/v0.2.1

@mattaezell
Copy link
Contributor Author

Unfortunately I don't think the current format is correct. I'm seeing
2018-02-02T08:34:59-0500.439 h41n04 [goconserver connected]
where the fraction of the second is attached to the timezone instead of the second. It should look like:
2018-02-02T09:42:39.060-05:00 h41n04 [goconserver connected]

Please consider merging #21

Thanks!

@chenglch
Copy link
Contributor

chenglch commented Feb 2, 2018

Sorry, I'm not familiar with the time format. The latest build including your patch has been uploaded.
Thanks.

@mattaezell
Copy link
Contributor Author

Thanks @chenglch. Looks good!

@neo954
Copy link

neo954 commented Mar 7, 2018

Verified with goconserver-0.2.1-snap201803020124.ppc64le. I will close this one.

if still have question against this issue, please don't hesitate to reopen this issue.

@neo954 neo954 closed this as completed Mar 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants