1
0
forked from baron/baron-sso

로그 포맷 통일, slog 적용

This commit is contained in:
2026-01-15 14:16:34 +09:00
parent 2aff11bc5d
commit 5dd2c94555
9 changed files with 286 additions and 32 deletions

View File

@@ -1,5 +1,29 @@
# Map ISO8601 time to "YYYY-MM-DD HH:mm:ss" format
map $time_iso8601 $time_custom {
"~^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})" "$1-$2-$3 $4:$5:$6";
}
# Custom JSON Log Format matching Go slog
log_format json_combined escape=json
'{'
'"time":"$time_custom",'
'"level":"INFO",'
'"msg":"http_access",'
'"svc":"baron-frontend",'
'"status":$status,'
'"method":"$request_method",'
'"path":"$request_uri",'
'"latency":"${request_time}s",'
'"ip":"$remote_addr",'
'"forwarded_for":"$http_x_forwarded_for",'
'"user_agent":"$http_user_agent"'
'}';
server {
listen 5000;
include /etc/nginx/mime.types;
access_log /var/log/nginx/access.log json_combined;
# Backend API Proxy
location /api {