1. The problem I’m having:
I would like both to stream log to the stdout and save it to a log file. is there a way to make it work?
I did not find a way to do both as global directive, docker by default prints in the docker logs console of the container but I would like to save it to a file as well, if I uncomment
log {
output file /var/log/caddy.log
}
log gets saved but nothing is shown
2. Error messages and/or full log output:
3. Caddy version:
v2.6.4
4. How I installed and ran Caddy:
a. System environment:
Docker, custom build with cloudflare dns and crowdsec plugin
b. Command:
c. Service/unit/compose file:
version: "3.6"
services:
caddy-dns:
container_name: "caddy-dns-proxy"
image: "ghcr.io/mariomare22/caddy-dns:latest"
networks:
- "internet"
- "caddy-proxy_local"
ports:
- "443:443/tcp"
restart: "unless-stopped"
volumes:
- "/home/mario/config/caddy/caddyfile:/etc/caddy"
- "/home/mario/config/caddy/data:/data"
- "/home/mario/config/caddy/config:/config"
- "/home/mario/config/caddy/log:/var/log"
d. My complete Caddy config:
{
acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
email myemail
# log {
# output file /var/log/caddy.log
#}
crowdsec {
api_url http://crowdsec:8080
api_key mylocalapi
ticker_interval 15s
#disable_streaming
#enable_hard_fails
}
}
(cloudflare) {
tls {
dns cloudflare myapikey
resolvers 1.1.1.1
}
}
(trusted_proxy_list) {
trusted_proxies 10.0.0.0/8 172.16.0.0/16
}
# Authelia Portal.
autheliadomain {
import cloudflare
reverse_proxy authelia:9091 {
import trusted_proxy_list
}
}