neoteknic
neoteknic

Reputation: 1970

Apache error log format

This is my errorlog format :

ErrorLogFormat "[%{u}t] [%-m:%l] [pid %P:tid %T] %7F: %E: [client\ %a] %M% , \"%{Referer}i\" \"%{User-Agent}i\""

Sometime I have :

(70007)The timeout specified has expired: [client *(client IP)*:57108] AH01075: Error dispatching request to : (polling)

But no script name/http request/file name = useless.

I just want something like {%script_name%} in the error (or the query if exist), for example with max excution timeout I don't have any request / filename.

Is it possible without access log ?

I have php-fpm 7.1 + apache 2.4 (no mod php)

Upvotes: 1

Views: 3161

Answers (1)

Fredrik
Fredrik

Reputation: 597

I also haven't found any simple ErrorLogFormat token for the request string. Instead I use mod_rewrite to set a variable which can then be used in ErrorLogFormat.

I use these settings:

RewriteEngine  on
RewriteRule .* - [E=REQ:%{THE_REQUEST}]
ErrorLogFormat "[%{cu}t] [%a] \\n% \ Server:\ %V\\n% \ Request:\ %{REQ}e\\n% \ %M\\n% \ Referrer:\ %{Referer}i\\n% \ UserAgent:\ %{User-Agent}i\\n"

Upvotes: 1

Related Questions