Access Log Filtering Program?
Moderator: General Moderators
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
Access Log Filtering Program?
I'm wondering if there is a program out there that will scan an access log and gives the option to delete or keep lines with certain strings? For example if you wanted to view a version of your access log that only contained POST methods, any line that did not contain the string "POST" would be removed from the log.
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
For multi-megabyte log files? Not a good idea.Maugrim_The_Reaper wrote:file_get_contents().
- ReverendDexter
- Forum Contributor
- Posts: 193
- Joined: Tue May 29, 2007 1:26 pm
- Location: Chico, CA
Oh, yeah, that is a possibiilty too, there's lots of native win32 ports a well.
http://gnuwin32.sourceforge.net/
http://gnuwin32.sourceforge.net/
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
- ReverendDexter
- Forum Contributor
- Posts: 193
- Joined: Tue May 29, 2007 1:26 pm
- Location: Chico, CA
That's the beauty of grep... all you'd have to do is go to your log directory, and do a "grep 'POST' file.log > post_only_log.txt" (double check my syntax, but it should be close), then use your favorite text editor/viewer to read your newly created post_only_log.txt file. And, grep takes regex, so you can make it as specific as you want for which lines go into your filtered log files, no PHP required.
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
http://gnuwin32.sourceforge.net/packages/grep.htm
I found grep / binaries and this isn't obviously simplified. Eventually found the dependencies and after using /? switch I'm getting the message grep: (standard input): not enough space
I found grep / binaries and this isn't obviously simplified. Eventually found the dependencies and after using /? switch I'm getting the message grep: (standard input): not enough space
- ReverendDexter
- Forum Contributor
- Posts: 193
- Joined: Tue May 29, 2007 1:26 pm
- Location: Chico, CA
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
- ReverendDexter
- Forum Contributor
- Posts: 193
- Joined: Tue May 29, 2007 1:26 pm
- Location: Chico, CA
oh, <smacks self in forehead>, sorry, my brain didn't parse '/?' at all when I read your post. If you're wanting help using it, I'd just consult the online manual.
Basially it's "grep [options] 'regexstring' location", so "grep -ir 'toast' ." will do an case insenstive search for lines containing "toast" in this directory and recurse through all subdirectories of this one. (-i is case insensitive, -r is recursion).
Basially it's "grep [options] 'regexstring' location", so "grep -ir 'toast' ." will do an case insenstive search for lines containing "toast" in this directory and recurse through all subdirectories of this one. (-i is case insensitive, -r is recursion).