Search code examples
dockergraylog

Graylog stream rule with application running on docker


I have an application that running on a docker container, and logs to our Graylog server, however, the Graylog source field is actually the container ID:

source
97c0212d3d75

Since the container ID changes frequently, I cannot apply the source to the stream rules.

I had a look at the message and seems like there is nothing much I can rely on to create stream rules for this application:

enter image description here

Can someone please share some experience on this case? My problem here is that I cannot identify the application nor environment.

I am looking for ideas like:

  1. Is there a way to make container id static (prob not)
  2. Is there a way to send more information to graylog without making code changes or making code to specify the specific values
  3. Any better ideas

Solution

  • I just realised I can set the hostname to my docker containers, so just by adding the following to my docker-compose file should work

    hostname: billing-rq-${ENV_NAME}