how to centralized log file on docker container?

How to centralized log file on docker container?

This log file is not in /var/lib/docker/container/*/

  • docker - change storage folder dynamically
  • Sharing a configuration file to multiple docker containers
  • Connect to Windows 10 Docker daemon from ubuntu bash
  • Host as Pid namespace in Docker
  • Docker-based PAAS supporting multiple containers
  • could not read Username for '': No such device or address
  • This log file is like catalina.out or another log file in container.
    (this file can be stdout/err or not).

    Many solution is almost about stdout/err( /var/lib/docker/container/* ).

    But I want to centralized log file in container to use ELK or Fluentd.

    Help me please.

  • Throttling Disk Utilization
  • Dockerizing npm & bower install using the digitallyseamless/nodejs-bower-grunt docker image
  • can not connect to docker container mapping port
  • nodemon not restarting after typescript change
  • Can not reach Kibana remotely using ELK Docker images
  • Transmission WebUI 409 in Docker Container
  • One Solution collect form web for “how to centralized log file on docker container?”

    You could use a forwarder container inside your pod and share a volume for the log directory, as follows:

    kind: ReplicationController
    apiVersion: v1
      name: tomcat
        app: tomcat
      replicas: 1
            app: tomcat
          - name: tomcat
            image: tomcat
            - name: tomcat-logs
              mountPath: /tomcat/log
              readOnly: false
          - name: logstash-forwarder
            image: apopelo/logstash-forwarder
            - name: tomcat-logs
              mountPath: /var/log/tomcat
              readOnly: true
          - name: tomcat-logs
            emptyDir: {}

    The tomcat container runs the app, while logstash-forwarder forwards tomcat logs.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.