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 timestaps in logs #802

Merged
merged 1 commit into from
Oct 16, 2020
Merged

Conversation

afrittoli
Copy link
Member

@afrittoli afrittoli commented Oct 15, 2020

Changes

The controller and webhook logs do not include timestamps, which
makes troubleshooting issues much harder.
Adding the timestamps into the default logging configuration.

Fixes: #800

Signed-off-by: Andrea Frittoli andrea.frittoli@gmail.com

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • [n/a] Includes tests (if functionality changed/added)
  • [n/a] Includes docs (if user facing)
  • Commit messages follow commit message best practices
  • Release notes block has been filled in or deleted (only if no user facing changes)

See the contribution guide for more details.

Release Notes

Add timestamp in the logs of the tekton pipelines controller, webhook, and eventlisteners

/kind feature

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. labels Oct 15, 2020
@tekton-robot tekton-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Oct 15, 2020
@afrittoli
Copy link
Member Author

/cc @mattmoor

@tekton-robot tekton-robot requested a review from mattmoor October 15, 2020 09:14
Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 15, 2020
@dibyom
Copy link
Member

dibyom commented Oct 15, 2020

Can we also add this to the EventListener's logger as well? (That will fix #800)

@afrittoli
Copy link
Member Author

afrittoli commented Oct 15, 2020

triggers/pkg/reconciler/v1alpha1/eventlistener/eventlistener.go

So, the event listener seems to be using config-logging-triggers - which means that it could load the same config already.
I think the problem might be that the event listener will live in a different namespace and have no access to the logging configmap in the tekton-pipelines namespace.

What I can do is to update the default content of the map, which is used when the config map is not available.

@afrittoli afrittoli closed this Oct 15, 2020
@afrittoli afrittoli reopened this Oct 15, 2020
The controller and webhook logs do not include timestamps, which
makes troubleshooting issues much harder.
Adding the timestamps into the default logging configuration.

Fixes: tektoncd#800

Signed-off-by: Andrea Frittoli <andrea.frittoli@gmail.com>
@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Oct 15, 2020
@afrittoli
Copy link
Member Author

Seems to be working fine:

$ k logs el-dashboard-nightly-release-cron-6bfc46d87f-s76th
{"level":"info","ts":"2020-10-15T20:23:59.199Z","caller":"logging/config.go:110","msg":"Successfully created the logger."}
{"level":"info","ts":"2020-10-15T20:23:59.199Z","caller":"logging/config.go:111","msg":"Logging level set to: info"}
{"level":"info","ts":"2020-10-15T20:23:59.200Z","caller":"logging/config.go:78","msg":"Fetch GitHub commit ID from kodata failed","error":"open /var/run/ko/HEAD: no such file or directory"}
{"level":"info","ts":"2020-10-15T20:23:59.200Z","logger":"eventlistener","caller":"logging/logging.go:46","msg":"Starting the Configuration eventlistener","knative.dev/controller":"eventlistener"}
{"level":"info","ts":"2020-10-15T20:23:59.300Z","logger":"eventlistener","caller":"eventlistenersink/main.go:72","msg":"EventListener pod started","knative.dev/controller":"eventlistener"}
{"level":"info","ts":"2020-10-15T20:23:59.304Z","logger":"eventlistener","caller":"eventlistenersink/main.go:98","msg":"Listen and serve on port 8080","knative.dev/controller":"eventlistener"}

Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 15, 2020
@dibyom
Copy link
Member

dibyom commented Oct 16, 2020

/approve

@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dibyom, mattmoor

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 16, 2020
@tekton-robot tekton-robot merged commit caf6ba9 into tektoncd:master Oct 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add timestamps to json log output of controller
4 participants