Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So basic question, but I can't seem to find an easy answer.

How do I record the date/time in my apache logs to have a unix timestamp (seconds since epoch).

I have the default LogFormat as:

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined
share|improve this question

1 Answer 1

Apache Module mod_log_config:

%{format}t  The time, in the form given by format, which should be in strftime(3) format. (potentially localized)

Example:

    LogFormat "%v %h %l %u %{%s}t \"%r\" %>s %b" vhost_common
    CustomLog /var/log/test vhost_common

Log:

127.0.1.1 127.0.0.1 - - 1309405372 "GET / HTTP/1.0" 200 177
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.