Hi there,
currently using this Caddyfile for a little research project. Everything works good so far and I’m happy with the caddy webserver.
# Caddy configuration file
:80 {
root * /usr/share/caddy/80
file_server
log port-80 {
output file /var/log/caddy/80-caddy.log {
roll_uncompressed
roll_local_time
roll_keep 20
roll_keep_for 365d
}
format json {
time_format wall
time_local
}
}
}
:8080 {
root * /usr/share/caddy/8080
redir / /devfileshare
file_server browse
log port-8080 {
output file /var/log/caddy/8080-caddy.log {
roll_uncompressed
roll_local_time
roll_keep 20
roll_keep_for 365d
}
format json {
time_format wall
time_local
}
}
}
}
Now I got a question regarding the file permissions of the logfiles.
We got a need to change the file rights to 640 (rw-r-----) instead of the default 600 (rw-------).
user: /var/log/caddy$ ls -lah
total 36K
drwxr-xr-x 2 caddy caddy 4.0K Jan 30 15:20 .
drwxr-xr-x 9 root root 4.0K Jan 30 00:00 ..
-rw------- 1 caddy caddy 17K Jan 30 15:37 8080-caddy.log
-rw------- 1 caddy caddy 6.4K Jan 30 15:37 8443-caddy.log
If I change the rights with the following command the caddy webserver log in the file without any problem.
user: /var/log/caddy$ sudo chmod 640 /var/log/caddy/*.log
user: /var/log/caddy$ ls -lah
total 36K
drwxr-xr-x 2 caddy caddy 4.0K Jan 30 15:20 .
drwxr-xr-x 9 root root 4.0K Jan 30 00:00 ..
-rw-r----- 1 caddy caddy 17K Jan 30 15:37 8080-caddy.log
-rw-r----- 1 caddy caddy 6.4K Jan 30 15:37 8443-caddy.log
But when the logfiles get deleted (by hand) and created again by the caddy webserver the file rights are still the same. Of course…
user: /var/log/caddy$ ls -lah
total 36K
drwxr-xr-x 2 caddy caddy 4.0K Jan 30 15:20 .
drwxr-xr-x 9 root root 4.0K Jan 30 00:00 ..
-rw------- 1 caddy caddy 13K Jan 30 15:40 8080-caddy.log
-rw------- 1 caddy caddy 68K Jan 30 15:40 8443-caddy.log
I just wanted to ask if it is possible to change the default file mask of caddy log files? Could not find anything about this in the docs.
Many thanks,