{"action":"created","issue":{"url":"https://api.github.com/repos/DataDog/datadog-agent/issues/1599","repository_url":"https://api.github.com/repos/DataDog/datadog-agent","labels_url":"https://api.github.com/repos/DataDog/datadog-agent/issues/1599/labels{/name}","comments_url":"https://api.github.com/repos/DataDog/datadog-agent/issues/1599/comments","events_url":"https://api.github.com/repos/DataDog/datadog-agent/issues/1599/events","html_url":"https://github.com/DataDog/datadog-agent/issues/1599","id":314864321,"number":1599,"title":"Logs in JSON format are prefixed with non-JSON","user":{"login":"jonmoter","id":1056506,"avatar_url":"https://avatars0.githubusercontent.com/u/1056506?v=4","gravatar_id":"","url":"https://api.github.com/users/jonmoter","html_url":"https://github.com/jonmoter","followers_url":"https://api.github.com/users/jonmoter/followers","following_url":"https://api.github.com/users/jonmoter/following{/other_user}","gists_url":"https://api.github.com/users/jonmoter/gists{/gist_id}","starred_url":"https://api.github.com/users/jonmoter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonmoter/subscriptions","organizations_url":"https://api.github.com/users/jonmoter/orgs","repos_url":"https://api.github.com/users/jonmoter/repos","events_url":"https://api.github.com/users/jonmoter/events{/privacy}","received_events_url":"https://api.github.com/users/jonmoter/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-17T00:34:30Z","updated_at":"2018-04-17T16:38:33Z","closed_at":null,"author_association":"NONE","body":"Follow-on from #971.\r\n\r\nI've deployed the datadog agent (as a docker container in Kubernetes), setting the `DD_LOG_FORMAT_JSON` ENV var, and now I see logs appear in JSON format.  Kindof.  My logs have lines that look like this:\r\n\r\n```\r\n[ AGENT ] {\"time\":\"2018-04-17 00:20:21 UTC\",\"level\":\"INFO\",\"file\":\"start.go\",\"line\":\"174\",\"func\":\"StartAgent\",\"msg\":\"Hostname is: i-0d6aeb84eb49fe72b\"}\r\n```\r\n\r\nThat string is not parseable JSON. It has a sub-string that is parseable JSON. But I'd need to pre-process each log line to extract the part that is JSON, and feed that into my JSON parser.\r\n\r\nI'm using fluentd for log collection. So it is possible to do my own regex parsing of logs.  But I was hoping that when I enabled logging as JSON, each line would be a valid JSON hash.  Ideally, something like:\r\n\r\n```\r\n{\"component\": \"AGENT\", \"time\":\"2018-04-17 00:20:21 UTC\",\"level\":\"INFO\",\"file\":\"start.go\",\"line\":\"174\",\"func\":\"StartAgent\",\"msg\":\"Hostname is: i-0d6aeb84eb49fe72b\"}\r\n```\r\n\r\nThen my log processor is really simple, which is why logging in JSON is appealing.\r\n\r\nI'm currently running the agent as a docker image, using the `datadog/agent:6.1.0-jmx` image.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/DataDog/datadog-agent/issues/comments/382060556","html_url":"https://github.com/DataDog/datadog-agent/issues/1599#issuecomment-382060556","issue_url":"https://api.github.com/repos/DataDog/datadog-agent/issues/1599","id":382060556,"user":{"login":"jonmoter","id":1056506,"avatar_url":"https://avatars0.githubusercontent.com/u/1056506?v=4","gravatar_id":"","url":"https://api.github.com/users/jonmoter","html_url":"https://github.com/jonmoter","followers_url":"https://api.github.com/users/jonmoter/followers","following_url":"https://api.github.com/users/jonmoter/following{/other_user}","gists_url":"https://api.github.com/users/jonmoter/gists{/gist_id}","starred_url":"https://api.github.com/users/jonmoter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonmoter/subscriptions","organizations_url":"https://api.github.com/users/jonmoter/orgs","repos_url":"https://api.github.com/users/jonmoter/repos","events_url":"https://api.github.com/users/jonmoter/events{/privacy}","received_events_url":"https://api.github.com/users/jonmoter/received_events","type":"User","site_admin":false},"created_at":"2018-04-17T16:38:33Z","updated_at":"2018-04-17T16:38:33Z","author_association":"NONE","body":"Also, I notice that only enable JSON logging in for `AGENT`. Logging for the trace agent still appears in non-JSON format.\r\n\r\nIs there a way to set JSON logging globally for all components?"}}
{"actor":{"display_login":"jonmoter"}}