3

How to show timezone in the apache 2.4.25 ErrorLog. I have put the ErrorLogFormat in VirtualHost :

ErrorLogFormat "%{cu}t"

But than I only get 2018-02-08 10:02:59.246032. Which is the time in the +01:00 time in fact.

In LogFormat it is possible just by %{%Y-%m-%dT%H:%M:%S}t.%{msec_frac}t%{%z}t which gives 2018-02-08T10:07:46.161+0100. When I use the same in ErrorLogFormat I get Thu Feb 08 10:07:46 2018.2018-02-08 10:07:46Thu Feb 08 10:07:46 2018 instead.

Is there a way to show the correct timezone?

luki
  • 31

2 Answers2

2

It seems that it is not possible. With LogFormat it passes the format to strftime(3), but with ErrorLogFormat it does not.

If the timezone is important to your ErrorLog, you can consider to use Logstash / ELK-stack for parsing the logs and adding a timestamp to the log entry before it is indexed.

pkhamre
  • 6,400
0

The capability to get strftime in ErrorLogFormat is now available in the Apache HTTPD trunk branch in version 2.5.1: https://github.com/apache/httpd/blob/trunk/CHANGES

Look for PR 62161