简体   繁体   中英

How to enable logging on influxdb to a file in docker

I have influxdb running using docker and currently logs can be seen only by docker logs command but I want the logs in /var/log/file.log how can I achieve it.

I tried adding

RUN ln -sf /dev/stdout /var/log/influx.log \
    && ln -sf /dev/stderr /var/log/error.log

in the docker file but it seems not woking.

The path : "/var/log/file.log" you are talking about, it is inside your machine or the container ?

If you are talking about the path inside the container, you can try docker exec "container name" ln -sf /dev/stdout /var/log/influx.log \\ && ln -sf /dev/stderr /var/log/error.log.

If you are talking about the path inside your machine, you should give the docker daemon the right to write inside /var/log/ and you should configure the "volume" section of your docker compose file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM