Skip to content

Commit 438f233

Browse files
committed
feat: caddy logging settings
1 parent 8fc7aa6 commit 438f233

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

Caddyfile

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,29 @@
11
:80 {
2-
encode zstd gzip
32
root * /srv
43
file_server
54

65
header /assets/* Cache-Control "public, max-age=31536000, immutable"
76

7+
log {
8+
output file /var/log/caddy/access.log {
9+
roll_size 100MiB
10+
roll_keep_for 2160h
11+
}
12+
format filter {
13+
wrap json
14+
fields {
15+
request>remote_ip ip_mask {
16+
ipv4 24
17+
ipv6 48
18+
}
19+
request>client_ip ip_mask {
20+
ipv4 24
21+
ipv6 48
22+
}
23+
}
24+
}
25+
}
26+
827
handle_errors {
928
respond "{err.status_code} {err.status_text}" {err.status_code}
1029
}

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ COPY . .
66
RUN npm run build
77

88
FROM caddy:2-alpine
9+
RUN mkdir -p /var/log/caddy
910
COPY Caddyfile /etc/caddy/Caddyfile
1011
COPY --from=build /app/dist /srv

0 commit comments

Comments
 (0)