crazy-max/docker-fail2ban

Log attachment automation

Closed this issue · 1 comments

Hi Max,
Thanks for all your hard work on this project!

I was wondering about the log system implementation with compose though. Since the startup requires logs -f, I'm wondering how I might bake this into restart policies? If the system goes down, or the docker gets detattached from the console log output for some reason..would you have any recommendations for tieing them together?

Thanks

Hi @rexdjw,

Sorry for the delay, pretty busy those days 🚀

By default, Docker captures the standard output (and standard error) of containers, and writes them in files using the JSON format using the default JSON File logging driver.

About compose, If you don't change the name of root folder of your compose file and service name inside, logs will be kept across restart or host shutdown. You can docker inspect your container to see where their logs are:

$ docker inspect --format='{{.LogPath}}' <container id/name>

If you want to manage logs yourself, you can use F2B_LOG_TARGET to change log target. You can use /data/failban.log to keep log persisted for example.