Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Custom Logs in Apache using Env

Options
  • 30-08-2005 12:04pm
    #1
    Registered Users 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 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