Mobile app version of vmapp.org
Login or Join

Login to follow query

More posts by @Kristi941

1 Comments

Sorted by latest first Latest Oldest Best

 

@Alves908

The CustomLog directive allows you to set a condition (in an optional 3rd argument) that is used to control when the request is logged. (On Apache 2.4+ this can take the form of an Apache Expression.) However, this condition is generally based on a property of the request (file type, request header, etc.), rather than something that is associated with the response. (Although it does seem possible to create a condition based on the HTTP response status, as this is explicitly made available in the REQUEST_STATUS server variable.)

However, I don't see a way to create a conditon based on the server response time. (?)

A workaround might be to specifically include this information in your access log using the format string %msT (if you specifically want this logged as milliseconds) in a custom log format. You can then filter this information using a log file analyzer.



%T - The time taken to serve the request, in seconds.
%{UNIT}T - The time taken to serve the request, in a time unit given by UNIT. Valid units are ms for milliseconds, us for microseconds, and s for seconds. Using s gives the same result as %T without any format; using us gives the same result as %D. Combining %T with a unit is available in 2.4.13 and later.



Reference: httpd.apache.org/docs/current/mod/mod_log_config.html#formats

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme