Apache 2.4 log

 

 

 


forensic log

 

一般的 Log - Access Log

The server access log records all requests processed by the server.

forensic

# Module: mod_log_forensic (Apache 2.4)

Logging is done before (after receiving the headers) and after processing a request,

so the forensic log contains two log lines for each request.

* The format is fixed.

* If it cannot write its data, the child process exits immediately and may dump core

The plus character at the beginning indicates that this is the first log line of this request.

The second line just contains a minus character and the ID again

Setting

touch /etc/httpd/conf.modules.d/00-log_forensic.conf

LoadModule log_forensic_module modules/mod_log_forensic.so

ForensicLog filename

service httpd reload

 


Conditional Logs

 

# Mark requests from the loop-back interface

SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog

# Mark requests for the robots.txt file

SetEnvIf Request_URI "^/robots\.txt$" dontlog

# Log what remains

CustomLog logs/access_log common env=!dontlog

 


Debug with -X

 

Run httpd in debug mode.

Only one worker will be started and the server will not detach from the console.