perl script to filter logfile

i was wondering if anyone can help me, how could i write in perl a a script that would look through a log file and print onscreen the contents of the log file excluding lines that contain '192.168.1.' and entries that contain directory paths that arent in the directory /usr/local/httpd/htdocs/ i have no expierience in perl. what i want to do is this, i want to be able to run this script to view one log file, the access_log in /var/log/httpd/ at first i would do this with 'grep -v 192.168.1. access_log that works to get rid of my internal network hits, but im tired of havintg to sift through all the people with port scanners hits on my server, most of the traffic on the site is just people running port scanners on my ip block. so if anyone can help i would apreaciate it alot, also i am thinking that this will start me off learning perl. if more info is needed i will gladly provide, thanks alot!

Actually, you can do this with a piped grep command if I am following you correctly.

How about this?

grep -v "192.168.1" access_log | grep -v "/usr/local/httpd/htdocs/" | less

that would work but i want to only see the entries that pertain to files that exist on the server, what i want to do is filter out log file entries that contain paths to files that dont exist, actually now that i think about i i think that i could do what you suggested except i will exclude the error number 404 to see only succesful hits. thanks for you help! haha i know i would not have thought of that if you didnt suggest piping grep, thank you!

that worked great, that saved me ALOT of time!!! what it ends up is
grep -v 192.168.1. access_log | grep -v 404 | more (or less!)

thanks again for the help

Not a problem. Always glad to help.

*Assumes manly muscle pose, once again, co-workers look puzzled * :smiley: