i've searched but cant seem to find out howto do this.... id like to remove specified ip's from my apache access_log and error_log file and place them in newly defined logs. ideally it would be an apache config change bbut i cant see anything to do it in the docs.... altho no i have not read all what seems lik e4M pages of them:) but a few searches brings no results. so im guessing id need to set up a cron job to do it for me..... anyone have any ideas or a url for a faq on it? thanks
teck wrote:
id like to remove specified ip's from my apache access_log and error_log file and place them in newly defined logs.
You need to use a combination of setenvif and customlog. This is a quick rework of an apache exmaple: SetEnvIf Remote_Addr "1.2.3.4" log1 specificip SetEnvIf Remote_Addr "1.2.3.5" log2 specificip CustomLog logs/logfile1 common env=log1 CustomLog logs/logfile2 common env=log2 CustomLog logs/access_log common env=!specificip /Per Jessen, Zürich -- http://www.spamchek.com/ - managed anti-spam and anti-virus solution. Let us analyse your spam- and virus-threat - up to 2 months for free.
On Saturday 25 February 2006 12:48, Per Jessen wrote:
teck wrote:
id like to remove specified ip's from my apache access_log and error_log file and place them in newly defined logs.
You need to use a combination of setenvif and customlog.
This is a quick rework of an apache exmaple:
SetEnvIf Remote_Addr "1.2.3.4" log1 specificip SetEnvIf Remote_Addr "1.2.3.5" log2 specificip
CustomLog logs/logfile1 common env=log1 CustomLog logs/logfile2 common env=log2 CustomLog logs/access_log common env=!specificip
/Per Jessen, Zürich k thanks... this works but :) it still logs the ip to the access_log as well? i added the lines to the end of httpd.conf if position would matter?
teck wrote:
This is a quick rework of an apache exmaple:
SetEnvIf Remote_Addr "1.2.3.4" log1 specificip SetEnvIf Remote_Addr "1.2.3.5" log2 specificip
CustomLog logs/logfile1 common env=log1 CustomLog logs/logfile2 common env=log2 CustomLog logs/access_log common env=!specificip
/Per Jessen, Zürich k thanks... this works but :) it still logs the ip to the access_log as well?
Did you keep your old log definitions perhaps? /Per Jessen, Zürich
On Saturday 25 February 2006 13:43, Per Jessen wrote:
teck wrote:
This is a quick rework of an apache exmaple:
SetEnvIf Remote_Addr "1.2.3.4" log1 specificip SetEnvIf Remote_Addr "1.2.3.5" log2 specificip
CustomLog logs/logfile1 common env=log1 CustomLog logs/logfile2 common env=log2 CustomLog logs/access_log common env=!specificip
/Per Jessen, Zürich
k thanks... this works but :) it still logs the ip to the access_log as well?
Did you keep your old log definitions perhaps?
yes i did but when i take out the line Include /etc/apache2/mod_log_config.conf my access_log fills with one word per line "combined"
teck wrote:
On Saturday 25 February 2006 13:43, Per Jessen wrote:
Did you keep your old log definitions perhaps?
yes i did but when i take out the line Include /etc/apache2/mod_log_config.conf my access_log fills with one word per line "combined"
Uh, I have no idea what you've got in /etc/apache2/mod_log_config.conf, and I can't really debug your apache config for you. My suggestion will work provided you don't have another line negating the effects - e.g. an unconditional CustomLog statement. /Per Jessen, Zürich
Uh, I have no idea what you've got in /etc/apache2/mod_log_config.conf, and I can't really debug your apache config for you.
My suggestion will work provided you don't have another line negating the effects - e.g. an unconditional CustomLog statement.
/Per Jessen, Zürich
hmmm well for some reason... its now working... :) i thank you very much!
On Saturday 25 February 2006 11:24, teck wrote:
i've searched but cant seem to find out howto do this....
Try harder! :-) First page of hits searching Google for "creating custom Apache2 logs": http://www.onlamp.com/pub/a/apache/2004/04/22/blackbox_logs.html?page=3 Disclaimer: This page doesn't have the specific answer you're seeking, but it *does* clearly address creating custom Apache logs. I didn't drill down further because that's *your* responsibility. Also, it should be possible (and is probably easier) to create a cron job using a script that copies out (not "removes") specific IP activity to a separate log. I'd almost bet money that a script like that already exists out there. good luck! Carl
participants (3)
-
Carl Hartung
-
Per Jessen
-
teck