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

Filebeat docker input: support reading of labels and env vars written by docker JSON File logging driver #8358

Closed
passing opened this issue Sep 19, 2018 · 0 comments · Fixed by #12306
Labels
containers Related to containers use case enhancement Filebeat Filebeat

Comments

@passing
Copy link

passing commented Sep 19, 2018

The docker input of filebeat is specialized to read log files written by the docker JSON File logging driver:

In the logging configuration of docker, it is possible to define which labels and environment variables should be included in the json logs:

{
    "log-driver": "json-file",
    "log-opts": {
        "labels": "stage",
        "env": "APPLICATION_NAME,MARATHON_APP_ID,MESOS_TASK_ID"
    }
}

in the logfiles, the labels and environment variables are added under the key "attrs" then:

{
  "log": "...log message...\n",
  "stream": "stdout",
  "attrs": {
    "APPLICATION_NAME": "test-service",
    "MARATHON_APP_ID": "/test/test-service",
    "MESOS_TASK_ID": "test_test-service.f1688116-b502-11e8-b3f9-02424fbc88a4",
    "stage": "prod"
  },
  "time": "2018-09-19T14:41:15.191384718Z"
}

with filebeat version 6.4, only "log", "stream" and "time" are used from the json log-file, "attrs" are not included.

(Using the "add_docker_metadata" processor only allows to add labels but no environment variables to events)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
containers Related to containers use case enhancement Filebeat Filebeat
Projects
None yet
2 participants