Apache2 LogFormat Log 加上毫秒紀錄

Apache 的 Access log 一般都是以秒為單位,開啟詳細的 Log 格式為下述:

  • LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined

官方說明:Log Files - Apache HTTP Server Version 2.4

  • %t 的格式:[day/month/year:hour:minute:second zone], e.g: [01/Oct/2020:13:55:36 +0800]
[10/Oct/2000:13:55:36 -0700] (%t) The time that the request was received. The format is:

[day/month/year:hour:minute:second zone]
  day = 2digit
  month = 3letter
  year = 4digit
  hour = 2digit
  minute = 2digit
  second = 2digit
  zone = (`+' | `-') 4digit

想要將精確度到毫秒、微秒等級,要怎麼做呢?

  • 註:Debian、Ubuntu Linux 設定檔:/etc/apache2/apache2.conf

閱讀全文〈Apache2 LogFormat Log 加上毫秒紀錄〉