Log in the container via docker-compose

in my docker compose file , i have this - LOG_PATH=/opt/domoticz/userdata/log/domoticz.log and the log is wrote in the var/log
i needed the log for fail2ban

but the log of the container content the same log of my file domoticz.log is it possible to desactivate the container log from domoticz application ?

i see the topic https://docs.docker.com/compose/compose-file/compose-file-v2/#logging and put

      driver: none

but when i launch the command docker container logs -f domoticz
Error response from daemon: configured logging driver does not support reading, perhaps it’s exclusive !

Tow point
how can i desactivate the domoticz log in the container log ?
how can i put the json-file log in the directory /var/log (it’s a tmpfs directory)

I feel you should try to explain your problem better. I’m not exactly sure what you want to deactivate (I guess this is what you meant) and I know nothing about Domoticz. Containerized applications usually log to the containers standard output and error stream. That is what you the logging drivers collect and save in a file or send to a remote server. If you set the logging driver to be “none”, there will be nothing to save the logs from the standard streams and the docker logs command will not return anything.

If you don’t want the container to log in a file inside the container, that is something for which you need to know the application or at least have a documentation for the Docke rimage you are using where the author hopefully documented it.

Assuming the environment variable can be changed to any file path and the application doesn’t need it to be a regular file, you can try to set this:


so log lines that were saved in the domoticz.log file will appear in the output of docker logs, just don’t disable the logging driver by setting it to “none”

i have this in my docker-compose.yml

- LOG_PATH=/opt/domoticz/userdata/log/domoticz.log

but if i excecute this command

docker container logs -f domoticz

i have the same log in the domoticz.log and in the log of the domoticz container

How can i activate only the log in the output file domoticz.log in the parameters of the docker-compose.yml ?

I don’t know domoticz better than I knew when I wrote my previous message so I can’t help you with that. All I can say is that either the variable is not used by the app or you forgot to recreate the container by running. For better answers you will need to ask someone who knows Domoticz.

Maybe here? https://www.domoticz.com/forum/

i implemented the code in the daemon.json
“log-driver”: “journald”,
“log-opts”: {
“tag”: “{{.Name}}”

the log are sent in the journal in /var/log/journal in RAM, the solution is better