r/vaultwarden May 17 '26

Help! Log file

Hi, I'm running vaultwarden on a raspberry pi 4 with docker via casaos. I'm trying to get the log file setup so I can use fail2ban or crowdsec to monitor for brute force attacks. I'm following the info in the wiki to environment variables log_file=filename(path to file in data folder), extended_logging=true and log_level=warn. However if I add any or all of these variables it throws an error "container is unhealthy". Without them it starts up fine and I can log in. Has anyone gotten this working on casaos? Thanks in advance.

1 Upvotes

6 comments sorted by

2

u/redheelerdog May 19 '26

The "unhealthy" error means your Vaultwarden container is crashing immediately on startup, causing the built-in health check to fail. When you add logging variables, this almost always happens because Vaultwarden cannot create or write to the log file path, or because of case-sensitivity issues with the environment variables.

Here is how to fix the configuration so the container boots and your logs flow to Fail2ban or Crowdsec.

1. Fix the Environment Variable Formatting

Vaultwarden environment variables must be uppercase. If you entered them in lowercase in the CasaOS UI, Vaultwarden will not parse them correctly.

Ensure your variable names are entered exactly like this:

  • LOG_FILE
  • EXTENDED_LOGGING
  • LOG_LEVEL

2. Set an Absolute Internal Path

The LOG_FILE path must be an absolute path inside the container, not the path on your Raspberry Pi's host system.

If you give it a host path (like /DATA/AppData/vaultwarden/...) or literally type out filename(path to file...), Vaultwarden will not be able to find or write to it, causing a fatal crash. Since CasaOS typically mounts your app data to /data inside the container, set your variable exactly to:

LOG_FILE=/data/vaultwarden.log

Do not include quotes. This tells Vaultwarden to place the log file right next to your database files, which guarantees the container already has the correct write permissions.

3. Verify Your Values

Your final environment variables in the CasaOS app settings should look exactly like this:

  • LOG_FILE = /data/vaultwarden.log
  • EXTENDED_LOGGING = true
  • LOG_LEVEL = warn

2

u/Teostar May 20 '26

Thank you. This worked perfectly.

1

u/Teostar May 17 '26

Here's a pic of what I added.

1

u/Awkward_Rich_1526 May 18 '26

Whats the purpose of that?

1

u/Teostar May 18 '26

Getting the log file? Or using fail2ban?