4

With apache, is it possible to filter out log requests into separate files based on the URL?

So for example:

127.0.0.1 - - [08/Apr/2013:17:06:26 +0100] "GET /this/is/a/url.html HTTP/1.1" 200 67486

Log this specific URL into access_log_first and everything else into another log file?

I did a little research and it seems I could use something like SetEnvIf but not sure how to got about setting it up. Could anyone help out?

I realise this is somewhat a strange requirement and under normal circumstances I would run the URL I need logging on a separate subdomain for example.

1 Answer 1

8

Yes, SetEnvIf is the right way. Here's an example:

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

If you also want to remove those entries from the regular log, add the following:

CustomLog access.log common env=!thisurllog

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .