Apache日志格式时间戳无法获取时区偏移量

时间:2016-08-30 01:14:51

标签: httpd.conf apache2.4 apache2.2

LogFormat "{ \
        \"@timestamp\": \"%{%Y-%m-%dT%H:%M:%S%Z}t\", \
        \"@version\": \"1\", \
        \"clientip\": \"%a\", \
        \"status\": %>s, \
        \"bytes\": %B, \
        \"request\": \"%U%q\", \
        \"referer\": \"%{Referer}i\", \
        \"useragent\": \"%{User-agent}i\" \
        }" combinedJSON

输出时间戳名称而不是+0400,例如:

"@timestamp": "2016-08-29T16:50:37 Pacific Daylight Time", 

应该是:

"@timestamp": "2016-08-29T16:50:37 -0700",  

是否无法提取时区偏移而不是时区名称?

1 个答案:

答案 0 :(得分:2)

在linux&#es; strftime()上,偏移量为小写' z'。你使用了大' Z'这是时区名称/缩写。

(mod_log_config只是将格式传递给系统strftime,因此无法真正记录值)

相关问题