1

I use Grafana Loki for showing Logs of my Kubernetes Cluster. After creating a Query inside the Explore tab I see the log line, but it seems that all log lines a strings and not the expected JSON. My promtail collects the logs with docker mode. So Maybe someone have an idea what I do wrong or miss with my logs to show the result as JSON?

Sample Logline:

"{\"t\":{\"$date\":\"2022-08-23T10:04:09.950+00:00\"},\"s\":\"I\",  \"c\":\"NETWORK\",  \"id\":51800,   \"ctx\":\"conn85878\",\"msg\":\"client metadata\",\"attr\":{\"remote\":\"127.0.0.1:57270\",\"client\":\"conn85878\",\"doc\":{\"application\":{\"name\":\"MongoDB Shell\"},\"driver\":{\"name\":\"MongoDB Internal Client\",\"version\":\"4.4.12\"},\"os\":{\"type\":\"Linux\",\"name\":\"PRETTY_NAME=\\\"Debian GNU/Linux 10 (buster)\\\"\",\"architecture\":\"x86_64\",\"version\":\"Kernel 4.19.0-21-amd64\"}}}}\n"

enter image description here

IFThenElse
  • 131
  • 1
  • 10

1 Answers1

0

Actually, I ran in the same issue, and it appears to be a promtail scraping issue.

The current (promtail-6.3.1 / 2.6.1) helm chart default is to have cri as pipeline's stage, which expects this kind of logs:

"2019-04-30T02:12:41.8443515Z stdout xx message"

Tryo to use docker, which expects json, for example, if you have a yaml value files:

config:
  snippets:
    pipelineStages:
      - docker: {}
GlinesMome
  • 1,549
  • 1
  • 22
  • 35