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

docker-driver: loki-relabel-config does not remove the source label #3812

Closed
rgl opened this issue Jun 7, 2021 · 2 comments
Closed

docker-driver: loki-relabel-config does not remove the source label #3812

rgl opened this issue Jun 7, 2021 · 2 comments

Comments

@rgl
Copy link
Contributor

rgl commented Jun 7, 2021

Describe the bug

loki-relabel-config does not remove the source label

To Reproduce

Steps to reproduce the behavior:

  1. Start Loki 2.2.1
  2. Install the docker-driver 2.2.1 docker plugin
  3. Set the following docker 20.10.7 daemon configuration:
    {
      "debug": true,
      "log-driver": "loki",
      "log-opts": {
        "loki-url": "http://10.10.0.2:3100/loki/api/v1/push",
        "loki-external-labels": "job=docker",
        "loki-relabel-config": "- regex: filename|source\n  action: labeldrop\n"
      }
    }
  4. Query: logcli query --tail '{job="docker"}'

Got:

2021-06-07T08:09:27+01:00 {container_name="hello-docker", host="linuxkit-52540080b679", job="docker", source="stdout"} hello docker Mon Jun 7 07:09:27 UTC 2021

Expected behavior

I expected the source label to be removed.

Please note that the filename label was removed as expected.

@cyriltovena
Copy link
Contributor

The source label is actually always added if it has a value from docker. To remove it you need to use pipeline stages, which are run at last on every lines.

The relabeling phase is happening only once per container and it is applied on the container metadata once it starts, at this point the label doesn't yet exist.

@rgl
Copy link
Contributor Author

rgl commented Jun 7, 2021

Thank you for clarifying this for me! It all makes sense now :-)

Will try to use the pipeline stage.

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

No branches or pull requests

2 participants