简体   繁体   中英

Logging every request to a certain file

I want to log all request- (and maybe also response-) headers of requests, that are made to a certain file on an Apache server. I have tried a php script, but that only fires when I request it directly. Is there any way to log all the requests on a file that I can specify? (If it does matter: in my case the file I want to log the requests for, is a mp4 file.)

Yes you can set and environmental variable to use for determining logging behavior

SetEnvIf Request_URI /this/is/a/url.html$ thisurllog
CustomLog thisurl.log common env=thisurllog
CustomLog access.log common env=!thisurllog

The last line will prevent the entries for that URI from logging in common access log. You can omit if you are OK with double logging into both logs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM