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

Configure components to log human-readable RFC3339 timestamps #133

Merged
merged 1 commit into from Feb 26, 2019

Conversation

@emalm
Copy link
Member

emalm commented Jan 24, 2019

This change configures the cf-tcp-router, route-registrar, and routing-api components to format the timestamps in their logs in RFC3339 format, which is more human-readable than the current Unix epoch timestamp while still being straightforward for machines to process. Log levels are also displayed as human-readable strings (debug,info,error, and fatal) instead of integers from 0 to 3.

A BOSH operator can observe the effects of this change by inspecting the stdout logs of the route_registrar, routing-api, and tcp_router jobs in a BOSH-deployed CF environment.

Log output examples

Route Registrar

{"timestamp":"2019-01-24T11:32:37.238408184Z","level":"info","source":"Route Registrar","message":"Route Registrar.Registering route","data":{"route":{"Type":"","Name":"api","Port":9022,"TLSPort":9024,"Tags":{"component":"CloudController"},"URIs":["api.bosh-lite.com"],"RouterGroup":"","Host":"","ExternalPort":null,"RouteServiceUrl":"","RegistrationInterval":10000000000,"HealthCheck":{"Name":"api-health-check","ScriptPath":"/var/vcap/jobs/cloud_controller_ng/bin/cloud_controller_ng_health_check","Timeout":6000000000},"ServerCertDomainSAN":"api.bosh-lite.com"}}}
{"timestamp":"2019-01-24T11:32:37.238501256Z","level":"info","source":"Route Registrar","message":"Route Registrar.Registered routes successfully","data":{}}

Routing API

{"timestamp":"2019-01-24T11:32:21.642962913Z","level":"info","source":"routing-api","message":"routing-api.prune-routes.successfully-finished-pruning-tcp-routes","data":{"rowsAffected":0,"session":"7"}}
{"timestamp":"2019-01-24T11:32:21.643422582Z","level":"info","source":"routing-api","message":"routing-api.prune-routes.successfully-finished-pruning-http-routes","data":{"rowsAffected":0,"session":"7"}}

TCP Router

{"timestamp":"2019-01-24T11:32:16.273178217Z","level":"info","source":"tcp-router","message":"tcp-router.watcher.Subscribing-to-routing-api-event-stream","data":{"session":"6"}}
{"timestamp":"2019-01-24T11:32:16.492452007Z","level":"info","source":"tcp-router","message":"tcp-router.watcher.Successfully-subscribed-to-routing-api-event-stream","data":{"session":"6"}}
  • I have viewed signed and have submitted the Contributor License Agreement

  • I have made this pull request to the develop branch

  • I have run all the unit tests using scripts/run-unit-tests

    • N/A: this PR introduces no changes to component code (although it does bump the lager library).
  • I have run Routing Acceptance Tests and Routing Smoke Tests on bosh lite

    • N/A: this PR introduces no changes that are expected to affect behavior that the acceptance tests assess.
  • I have run CF Acceptance Tests on bosh lite

    • N/A: this PR introduces no changes that are expected to affect behavior that the acceptance tests assess.
This change configures the cf-tcp-router, route-registrar, and routing-api components to format the timestamps in their logs in RFC3339 format, which is more human-readable than the current Unix epoch timestamp while still being straightforward for machines to process.
@cfdreddbot

This comment has been minimized.

Copy link
Collaborator

cfdreddbot commented Jan 24, 2019

Hey emalm! The commit authors and yourself have already signed the CLA.

@shubhaat

This comment has been minimized.

Copy link
Contributor

shubhaat commented Jan 24, 2019

Thanks for submitting @emalm. I am going to send out a note on cf-dev before prioritizing this.

@emalm

This comment has been minimized.

Copy link
Member Author

emalm commented Jan 24, 2019

Thanks, @shubhaat ! Also, it looks like either @cf-gitbot itself or the integration with the routing-release repo is broken, since I don't see a corresponding Routing tracker story for this PR. (Edit: Never mind, it eventually showed up. Networks!)

@cf-gitbot

This comment has been minimized.

Copy link
Collaborator

cf-gitbot commented Jan 24, 2019

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/163463509

The labels on this github issue will be updated when the story is started.

@shalako

This comment has been minimized.

Copy link
Member

shalako commented Jan 24, 2019

I love this log format :)

@emalm

This comment has been minimized.

Copy link
Member Author

emalm commented Jan 24, 2019

By the way, I'm pretty sure you can get the gorouter's stdout logs to be similar, or at least to have the RFC3339-format timestamps in the JSON, with some of the zap logger options, but it would take some code changes and perhaps an update to pull in a newer zap version.

@KauzClay

This comment has been minimized.

Copy link
Member

KauzClay commented Feb 27, 2019

Hi @emalm , are you able to reopen this? I had to revert the merge, but I can't seem to mark this as still open. I don't want to lose track of it

@emalm

This comment has been minimized.

Copy link
Member Author

emalm commented Feb 27, 2019

@KauzClay Nope, I don't think that's possible with merged PRs. I could try submitting a new PR of the same branch against the latest develop HEAD, though.

@KauzClay

This comment has been minimized.

Copy link
Member

KauzClay commented Feb 27, 2019

@emalm darn, okay. Well if you could please do that, I'd appreciate it, thanks

@emalm

This comment has been minimized.

Copy link
Member Author

emalm commented Feb 27, 2019

Done: #140

@KauzClay

This comment has been minimized.

Copy link
Member

KauzClay commented Feb 27, 2019

Thank you @emalm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.