mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2005
Posts: 449
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
Hi,

I haven't worked with /filter, so I'm not sure how to do this, but I figured that /filter would be the command to use. When I access my website from a browser, it adds my connection to the log file, which can add quite a few lines if I'm testing something. I'd like to have a mIRC script that will search for my entries in the log file and delete them. If I understand correctly, filter will act on that file and write the matches to a new file. Would there be a way to write the new file with all my entries taken out, delete the old log and rename the new file with the old name? The entries look like this (with some variations depending on the page visited):

192.168.1.97 - - [28/Mar/2006:18:09:22 -0500] "GET /project_files/image012.jpg HTTP/1.1" 200 1182

The log file is located at "C:\Program Files\Apache Group\Apache2\logs\access.log". Thanks for any help.

Joined: Dec 2004
Posts: 66
B
Babel fish
Offline
Babel fish
B
Joined: Dec 2004
Posts: 66
Not sure I fully understand the situation, but say for example 192.168.1.97 is your address and you want to strip all lines starting with it from the log file:
Code:
/Apache.Strip {
  var %LogFile = “C:\Program Files\Apache Group\Apache2\logs\access.log”
  filter -ffxc %LogFile %LogFile 192.168.1.97*
} 

See Help for what the -ffxc switches do.

Joined: May 2005
Posts: 449
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
Thanks, that's what I needed. And I looked up those options. x excludes matches, the f's are because they're both files, and c clears the file before writing. smile

Joined: May 2005
Posts: 449
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
Hey,

I just ran that code and it didn't work. I made a copy of the log file and put it on my desktop so I wasn't messing with the real one when I tested, and the lines with that IP are still there. Any ideas? Here's the code with the small change for location.
Code:
/Apache.Strip {  var %LogFile = “C:\Documents and Settings\Owner\Desktop\access.log”  filter -ffxc %LogFile %LogFile 192.168.1.97*} 

Joined: Mar 2005
Posts: 420
X
Fjord artisan
Offline
Fjord artisan
X
Joined: Mar 2005
Posts: 420
There should be a "|" before filter so mIRC can evaluate the word after it.


If you have a plastic floor runner over your tiles, then you're one Hella Pinoy!
Joined: May 2005
Posts: 449
Fjord artisan
OP Offline
Fjord artisan
Joined: May 2005
Posts: 449
Thanks, I got that working (with Bob57's help). I made the alias two lines, and Bob helped me figure out another change to make it work. It seems like one part of the problem was a mIRC version issue. He's using 6.16 and I'm using 6.17. Here's the end result
Code:
/Apache.Strip {  var %LogFile = $shortfn( C:\Program Files\Apache Group\Apache2\logs\access.log )  
  filter -ffxc %LogFile %LogFile 192.168.1.101* 
}


I changed the IP to my new one since I got a firewall, and changed the file path to the working file after I tested it.


Link Copied to Clipboard