Sponsored Content
Top Forums Shell Programming and Scripting perl script to filter logfile Post 27412 by norsk hedensk on Friday 30th of August 2002 03:32:16 PM
Old 08-30-2002
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!
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to manipulate logfile text

Hi guys, I was wandering if a Shell guru could give me some advice on tackling a problem. I have used a mixture of grep, cut and awk to get data from a log file in the following format: 14/11/08 10:39: Checking currenly : Enabled 14/11/08 10:39: Records allocated : 221... (11 Replies)
Discussion started by: rosspaddock
11 Replies

2. Shell Programming and Scripting

Attaching a logfile to the Script

Hello guys. I've recently written a basic utilities script just for home use. and i want to attach a logfile to it that will record all the commands that where executed in that script. Then just so i can add the d%b%y% and make each logfile unique and i can look back in each logfile to see what i... (9 Replies)
Discussion started by: matt02
9 Replies

3. Shell Programming and Scripting

Logfile rotation script.

I'm trying to find or create a Perl script that: Checks for and creates these files: notes notes.1 notes.2 notes.3 notes.4 The first represents the current log file and the others are older versions. Each time the script runs it would check for the existence of notes.3 and, if it exists,... (3 Replies)
Discussion started by: HardyV2
3 Replies

4. Shell Programming and Scripting

Logfile monitor script

Hi, I'm trying to write a logfile monitor script that reads the logfile and then emails out once there is an error with SQL in. Here is my attempt below which does not work. I'm not much of a scripter as you can probably see but some pointers in the right direction would be much appreciated. ... (3 Replies)
Discussion started by: elmesy
3 Replies

5. Shell Programming and Scripting

Unable to create logfile with local time stamp using perl

Hello All, Morning, I am facing problem with my code while creating a log with name as current time stamp using perl. Here is the code. #!/usr/bin/perl my $time=localtime; my ($day,$month,$date,$tm,$year)=split(/ /,$time); my $stamp=$year."_".$month."_".$date; my... (4 Replies)
Discussion started by: krsnadasa
4 Replies

6. UNIX for Dummies Questions & Answers

perl filter unique and concatenate

Hi experts, I have some input like below, TEST A function W TEST A function X TEST B function Y TEST C function Z TEST C function ZY i would like to have below output, TEST A function W&X TEST B function Y TEST C function Z&ZY Please kindly help on this, i am cracking my head... (2 Replies)
Discussion started by: mingfatty
2 Replies

7. Shell Programming and Scripting

Perl script to filter the string

Hi folks, I have a log file with the lines in the below format. Jul 1 23:00:51 10.212.3.251 SS: %SYS-7-CLI_SCHEDULE: some error occured I want to split the line based on the " %SYS-7-CLI_SCHEDULE: " value. The criteria is the should store the word that starts with % i.e., ... (1 Reply)
Discussion started by: scriptscript
1 Replies

8. Shell Programming and Scripting

Logfile monitoring with logfile replacement

Bonjour, I've wrote a script to monitor a logfile in realtime. It is working almost perfeclty except for two things. The script use the following technique : tail -fn0 $logfile | \ while read line ; do ... some stuff done First one, I'd like a way to end the monitoring script if a... (3 Replies)
Discussion started by: Warluck
3 Replies
MATCHERRC2PERLFILTER.PL(1)				User Contributed Perl Documentation				MATCHERRC2PERLFILTER.PL(1)

NAME
matcherrc2perlfilter -- Conversion of matcherrc rules to perl DESCRIPTION
This script converts matcherrc filtering rules into perl_filter rules for usage with the claws-mail-perl-filter plugin of the Claws Mail mailer. USAGE
matcherrc2perlfilter No arguments required. Conversion is done for current user only. FILES
$HOME/.claws-mail/matcherrc Input file where standard filtering rules lie. $HOME/.claws-mail/perl_filter Output file written by this script. Converted rules are appended if the file already exists, so be careful when running the script more than once. BUGS
This conversion script doesn't produce nice Perl code and is just intended to get you started. If you choose to use the Perl plugin, consider rewriting your rules. SEE ALSO
claws-mail-perl-filter(1), claws-mail(1) AUTHOR
This manual page was written by Ricardo Mones <mones@debian.org>, for the Debian GNU/Linux system (but may be used by others). The matcherrc2perlfilter was written by Holger Berndt <berndth@gmx.de>. perl v5.14.2 2012-11-17 MATCHERRC2PERLFILTER.PL(1)
All times are GMT -4. The time now is 12:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy