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

Support log json log format #8815

Closed
nicosto opened this issue Feb 5, 2021 · 4 comments · Fixed by #15751
Closed

Support log json log format #8815

nicosto opened this issue Feb 5, 2021 · 4 comments · Fixed by #15751
Assignees
Labels
area/elasticsearch area/json json and json_v2 parser/serialiser related area/logging feature request Requests for new plugin and for new features to existing plugins

Comments

@nicosto
Copy link

nicosto commented Feb 5, 2021

Feature Request

Opening a feature request kicks off a discussion.

Proposal:

enable json output for log

Current behavior:

ubuntu@ubuntu-lts:~$ kubectl -n intam logs telegraf-f494bc567-zmgq9 |head -50
2020-12-04T04:02:22Z I! Starting Telegraf
2020-12-04T04:02:22Z I! Using config file: /etc/telegraf/telegraf.conf
2020-12-04T04:02:22Z I! Loaded inputs: cpu internal internal kafka_consumer
2020-12-04T04:02:22Z I! Loaded aggregators:
2020-12-04T04:02:22Z I! Loaded processors: enum
2020-12-04T04:02:22Z I! Loaded outputs: prometheus_client kafka kairosdb health
2020-12-04T04:02:22Z I! Tags enabled:
2020-12-04T04:02:22Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"", Flush Interval:10s
2020-12-04T04:02:22Z D! [agent] Initializing plugins
2020-12-04T04:02:22Z D! [agent] Connecting outputs
....

Desired behavior:

in a Kubernetes infrastructure to be able to enable log JSON format support to handle multiline output.

Use case:

log can be across multi-line especially in debug mode. When stored in a backend (e.g. elasticsearch) each line creates an entry.

Thanks
Nicolas

@nicosto nicosto added the feature request Requests for new plugin and for new features to existing plugins label Feb 5, 2021
@sjwang90 sjwang90 added the area/json json and json_v2 parser/serialiser related label Feb 10, 2021
@sjwang90
Copy link
Contributor

sjwang90 commented Jul 20, 2021

@nicosto Can you provide an example of the log JSON data you'd like to read in?

@influxdata influxdata deleted a comment from nicolas17 Jul 20, 2021
@idrennanvmware
Copy link

+1 for this request. We use structured logging whenever possible across our log aggregators and most products already support this (json format or flat).

@serut
Copy link

serut commented Nov 29, 2023

From :

2020-12-04T04:02:22Z I! Starting Telegraf

To :

{"level":"info","msg":"Starting Telegraf","t":"2020-12-04T04:02:22.014980542Z"}

@srebhan
Copy link
Member

srebhan commented Aug 16, 2024

@nicosto, @idrennanvmware and @serut please test the binary in PR #15751, available once CI finished the tests, and let me know if this fixes this issue! You need to set logformat = "structured" in the agent section to enable structured logging...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/elasticsearch area/json json and json_v2 parser/serialiser related area/logging feature request Requests for new plugin and for new features to existing plugins
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants