Log to a file failed login for implementing Fail2ban

Is there a way to save a log file with the failed login of the Joplin Server in Docker?

I would like to implement some rules for using Fail2Ban.

Thanks

3 Likes

I second this.
I would be great if this small feature will be implemented in the future!

3 Likes

This is not a bad idea. I do have a few comments though.

Using log files within a container are IMO not a good idea. At least not when they are allowed to grow without restriction.
Of course there are different ways to workaround this. e.g. mapping that file to a file on the host.
But this also comes with drawbacks, if people are not familiar with Docker. Or some sort of system administration. Even the space on a host can be filled up by a chatty log.

But yes, I think it is a good idea. I haven't checked that part of the server code, but I doubt that it is very hard to implement.
It's rather a question of how. e.g. use one file in the container that only holds the last X (maybe 500-5000) login failures?

But we certainly need the ok from Laurent...

The server just logs to stdout, which is picked up by the Docker log, so is it not possible to use this and connect it to some file?

Sure, that works. There are like at least 5 different ways. I'm most partial to using fluentd in such a case.

When reading the OP's comment, it sounded like that info wasn't logged at all.

I noticed it but I don't know how to "force" docker to write out in a file the log of the container.

Does someone know a way in docker compose to write out the log file?

Thanks

You can use docker inspect joplin_server | grep "LogPath" to determine your current log file

The log options can also be configured

docker-compose.yml

    logging:
      driver: "json-file"
      options:
        max-file: "5"
        max-size: "10m"
1 Like

Here are a few more links to read up on that topic:

is there a way to map the log path to a mounted volumes...

on my machine the path is something like that...

/volume1/@docker/containers/499de24908fc870e6faa4bfd353117b43364921312d436bef37efd10dbf0119f/log.db

by default moreover is .db format not plain text...

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.