如题,我使用pipe方式记录access_log。但是想记录到不同的日志文件中。我的写法如下:access_log "pipe:/bin/cronolog logs/cronolog/%Y/%m/%Y-%m-%d-${logPath}" logformat;
access_log "pipe:/bin/cronolog logs/cronolog/%Y/%m/%Y-%m-%d-${logPath}" logformat;
但是${logPath}变量值无法引入。服务器上创建的日志文件就是2018-08-07-${logPath},变量值未替换。想问下,这种情况下该怎么处理?
piwo6bdm1#
http { log_format custom_log '$remote_addr - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent ' '"$http_referer" "$http_user_agent"'; server { listen 80; server_name example.com; access_log "pipe:/bin/cronolog logs/cronolog/%Y/%m/%Y-%m-%d-${logPath}" custom_log; location / { # Your server configuration } } }
1条答案
按热度按时间piwo6bdm1#