Influxdb 2.0 logging: How to get container logs into file (using docker-compose)


I need to get container logs into file and mount in local directory. Max N files and file size should be N mb each.

I used below command to get logs in file but it creates single file whose size can grow with time.

command: bash -c "influxd 2>&1 | tee -a /var/log/influxdb/influxdb.log"

I need to restrict file size and number of files created. How do I achieve this using configuration in influxdb ?

Any help appreciated.


Hello @Anaisdg

Could you please help me out ?


Hello @dhyaneshnaik,
Have you tried using:

head -c 1G

or tail?