Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Custom Logs in Apache using Env

  • 30-08-2005 12:04PM
    #1
    Registered Users, Registered Users 2 Posts: 7,541 ✭✭✭


    Hey all,

    Trying to do the following. Basically I want 3 different log files.

    Log 1: Contains all requests from a specified address.
    Log 2: Contains all requests for a certain file
    Log 3: All other requests

    To do this I need to do the following:

    SetEnvIf Remote_Addr "xxx\.xxx\.xxx\.xxx" iplog
    SetEnvIf Request_URI "some.file" filelog
    ErrorLog logs/nerderror.log
    CustomLog logs/ipaccess.log combined env=iplog
    CustomLog logs/fileaccess.log combined env=filelog
    CustomLog logs/access.log combined env=!iplog ||filelog

    But it's the last line I'm having probs with. How do i get it to log everything other than iplog and filelog requests?

    Thanks


Comments

  • Registered Users, Registered Users 2 Posts: 7,541 ✭✭✭irlrobins


    Answering my own question here.

    Apparantly you can set multiple variables:

    SetEnvIf Remote_Addr "xxx\.xxx\.xxx\.xxx" iplog nolog
    SetEnvIf Request_URI "some.file" filelog nolog

    CustomLog logs/ipaccess.log combined env=iplog
    CustomLog logs/fileaccess.log combined env=filelog
    CustomLog logs/access.log combined env=!nolog

    Thanks to Klaus Johannes Rusch for his help.


Advertisement