7

I'm having docker-compose.yaml as below:
My problem is that stdout prints or logs written to it are appearing in graylog- but just those under the command /usr/bin/tini -- foo1.start. And when I try entering the docker container of the service using:
docker exec -it [container_hash] bash
Launching command such as echo "Hello" or running a python script in which I will do import sys; sys.stdout.write("Hello again") --> no message of these will appear in received messages in graylog UI.

Any idea why stdout is not being collected via executing shell command or script within container? and collecting prints only from what run as a result of the make file command?

I don't understand this behavior as I piped all the stdout to gelf log-driver in docker-compose.
Edit: instructions how to use graylog in compose are from here

version: '3.4'
  services:  
     foo1:  
        ports:
          - target: 8081
            published: 8084
            mode: host
        networks:
          - dev-net
        command: make foo1.start
        logging:
            driver: gelf
            options:
               gelf-address: udp://localhost:12201

     some-mongo:
        image: "mongo:3"
        networks:
          - dev-net
     some-elasticsearch:
        image: "elasticsearch:2"
        command: "elasticsearch -Des.cluster.name='graylog'"
        networks:
          - dev-net
     graylog:
        image: graylog2/server:2.1.1-1
        environment:
           GRAYLOG_PASSWORD_SECRET: somepasswordpepper
           GRAYLOG_ROOT_PASSWORD_SHA2: 8c6976e5b5410415bde908bd4dee15dfb1
           GRAYLOG_WEB_ENDPOINT_URI: http://127.0.0.1:9000/api
        links:
           - some-mongo:mongo
           - some-elasticsearch:elasticsearch
        ports:
           - "9000:9000"
           - "12201:12201/udp"
        networks:
           - dev-net

  networks:
    dev-net:
      ipam:
        config:
          - subnet: 192.168.12.0/24
JavaSa
  • 5,813
  • 16
  • 71
  • 121

0 Answers0