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

why does fluentd filling logs with backslashes? #2407

Closed
conquerorAlex opened this issue May 6, 2019 · 5 comments
Closed

why does fluentd filling logs with backslashes? #2407

conquerorAlex opened this issue May 6, 2019 · 5 comments
Labels

Comments

@conquerorAlex
Copy link

conquerorAlex commented May 6, 2019

Need use fluentd to collect logs of kubernetes. But fluentd logs are spammed with backslashes like this:
record={"log"=\u003e"\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\", \"stream\"=\u003e\"stdout\", \"docker\"=\u003e{\"container_id\"=\u003e\"3138957a81d0f0479ed285f5cff1ae66a6d8afa8dc976514bb1d8881139d0220\"}, \"kubernetes\"=\u003e{\"container_name\"=\u003e\"fluentd-es\", \"namespace_name\"=\u003e\"kube-system\", \"pod_name\"=\u003e\"fluentd-es-v2.2.0-xhw49\", \"container_image\"=\u003e\"bossjones/fluentd-elasticsearch:v2.2.0\", \"container_image_id\"=\u003e\"docker-"

but also the logs contain hundreds of lines of just pure backslashes with no messages contained.

the config of fluentd as follow:

<filter kubernetes.**>
     @type record_transformer
      enable_ruby true
      <record>
        dockerid ${record["docker"]["container_id"]}
      </record>
</filter>

I found when getting nested field "container_id", the problem happens. However, if just set dockerid ${record["docker"]}, the problem solved. But now I need get the nested field container id. Then how to solve this?
I use the test case from: https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/fluentd-elasticsearch/fluentd-es-configmap.yaml. And added the above record_transformer to get container id from logs in path of /var/log/containers.

@bhargavamin
Copy link

I'm having the same issue but while using a tail plugin to read json logs from a file. #2405

I think this is an encoding issue of json logs just check if the logs are properly escaped.

@hvoigt
Copy link

hvoigt commented Jun 17, 2020

Is is possible that your fluentd is reading its own logs? Have a look at #2545 and the FLUENT_CONTAINER_TAIL_EXCLUDE_PATH variable which you can use to exclude fluentd's own logs from being forwarded.

@mickdewald
Copy link

I got this issue as well, because I was using containerd instead of docker. I solved it by putting in the following configuration:

- name: FLUENT_CONTAINER_TAIL_PARSER_TYPE
  value: /^(?<time>.+) (?<stream>stdout|stderr) [^ ]* (?<log>.*)$/

@github-actions
Copy link

This issue has been automatically marked as stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 30 days

@github-actions github-actions bot added the stale label Mar 18, 2021
@github-actions
Copy link

This issue was automatically closed because of stale in 30 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants