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

I'm not sure if this is possible, and haven't had any success yet. I'm trying to log page generation times at the web server level and currently have this working for all requests with mod_log_config and this configuration:

LogFormat "%h %t %>s %b %T %D \"%r\" " timeformat
CustomLog    /var/log/httpd/timing_log "timeformat"

That works, but is logging details for all requests, including static content like images, javascript, css, that I don't really care about.

Is there a way to log requests only if it was passed through PHP? The CustomLog directive has an optional third argument that can look at an environment variable to determine whether or not to log the request. I've tried looking at SetEnvIf to set that appropriately, but haven't come up with anything yet.

Suggestions?

share|improve this question
    
Are you sure you don't care about the static content? I would be inclined to log everything and filter out what I currently didn't care about at analysis time. Awstats can do this and I'm sure many other stats-analysis packages can do the same. –  Ben Dunlap Aug 26 '09 at 22:03
    
I'm already running awstats on the regular 'combined' log file. I would like to limit this log to only those requests served by PHP, but that doesn't seem to be available. You can use SetEnvIf to log based on characteristics of the request, but not based on the response (From what I can tell...) –  Brandon Aug 27 '09 at 20:50

1 Answer 1

I haven't done this, but the Conditional Logging section in the apache manual seems like a good starting point.

share|improve this answer
1  
That is about what I have been looking for. From what I can tell, you can use SetEnvIf to set an environment variable based on request headers, but not based on any response characteristics. I guess I'm probably stuck filtering those out based on regex's and such in looking through the generated list. –  Brandon Aug 27 '09 at 20:52

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.