shell scripts that parse log files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting shell scripts that parse log files
# 1  
Old 11-15-2006
shell scripts that parse log files

hi all ,i would like a shell script that parses log files and checks the contents for any anonalities,please help,thanks
# 2  
Old 11-15-2006
you're welcome.
If you could be more specific - you could get better help.
# 3  
Old 11-16-2006
example :
create file with content :
"tail -n 20 /var/log/messages tail -n 10 /var/log/auth.log"
save as file, chmod 755 and call it : ./your-desired-name
It will output the contents of the log files located at the respective places. As "vgersh99" pointed out before me, please be more specific in your questions to narrow the suggestions.
# 4  
Old 11-21-2006
shell script that look through the contents of logfiles

hi there,thanks for your replies.

What i meant to say was I need a shell script that look through the contents of multiple logfiles to locate anomolies, system attacks and faults.

Furthermore to be able to report via email the list of entries that do not match list of acceptable log entries.

Im more interested in the first part but if u can also do the second part,Your help would be highly appreciated.
Thanks.
# 5  
Old 11-22-2006
I'm posting my example with changed credentials, feel free to replace any values ; or use the logic Smilie : ( it's very simple )
Code:
#!/bin/sh
echo " " > /home/user/blacklist
for i in 2 3 4 5 6 7 8 9 10 
do
myVarScript -parameter www$i.domain.com >> /home/user/blacklist
sleep 10
done
line=`cat /home/user/blacklist |grep BLOCKED | wc -l`
echo $line
if [ $line -eq 0 ]
then
echo " "|mail -s "That's the subject" hostmaster@domain.com
else
cat blacklist | grep BLOCKED | mail -s "Did not match the pattern" hostmaster@domain.com
fi
exit 0


Last edited by sysgate; 11-23-2006 at 08:11 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell Script | Parse log file after a given date and time stamp

I am developing one script which will take log file name, output file name, date, hour and minute as an argument and based on these inputs, the script will scan and capture all the error(s) that have been triggered from a given time. Example: script should capture all the error after 13:50 on Jan... (2 Replies)
Discussion started by: ROMA3
2 Replies

2. Shell Programming and Scripting

Parse log files

Hi all, We are having a sample log like .... test.log:2015.03.17 06:16:24 >> ABC.generateMethod() MethodAException while processing Request! DataForm: Header --- dtd: template.dtd, titleName: berger, requestId: 1503170032131, documentName: invoice123, hostName: acme.net, userName: userABC... (10 Replies)
Discussion started by: tandrei
10 Replies

3. Shell Programming and Scripting

Having a single Log file for all the shell scripts

Bash on RHEL 6.2 We have multiple shell scripts executed by cron jobs. Each Shell script has its own log files currently. Most of them have logs generated using spool command from Oracle RDBMS's sqlplus commmand. Sample: #!/bin/bash sqlplus -s scott/tiger << EOF spool... (5 Replies)
Discussion started by: kraljic
5 Replies

4. Homework & Coursework Questions

Help with Shell Scripts Using sed in multiple files.

Hi, I was hoping that someone could help me. I have a problem that i am trying to work on and it requires me to change text within multiple files using sed. What i have so far is !/bin/sh File1="$3" File2="$4" File3="$5" testNum="$File1" while test "$testNum" <= "$File3"; do echo... (12 Replies)
Discussion started by: Johnny2518
12 Replies

5. Shell Programming and Scripting

Help with Shell Scripts Using sed in multiple files.

Hi, I was hoping that someone could help me. I have a problem that i am trying to work on and it requires me to change text within multiple files using sed. I use the program to change an occurance of a word throughout different files that are being tested. At first i had to Create a new script,... (1 Reply)
Discussion started by: Johnny2518
1 Replies

6. Shell Programming and Scripting

Help for shell scripts for moving all files from one directory to another

Hi , Can you please check this code .I am getting the follwing error while executing the script. Please help me out. #rm /tmp/$$ #!/bin/ksh dir_one="/usr/bin/sou" dir_two="usr/bin/sou/temp" for files in $dir_one/*.txt do ... (31 Replies)
Discussion started by: soumyamishra
31 Replies

7. UNIX for Dummies Questions & Answers

How can i parse my Unix log files??

Hello, i would like to parse Unix log files and i would like to use a Unix syslog analyzer. I'm going to use Eucalyptus and i would like to parse its log files. Is there any open source/free syslog parser?? Thanks, in advance! (2 Replies)
Discussion started by: g_p
2 Replies

8. Shell Programming and Scripting

Help to create a script to parse log files

Hello everybody, I need some help here to create a script to parse a log file. Here is a sample of the log file : 0x42258940 (Debug) Cache SUMMARY attrs now/668 min/668 max/668. 0x42258940 (Debug) RSVD SUMMARY reserved space max requested/128 MB accounted now/0 MB 0x42258940 (Debug)... (12 Replies)
Discussion started by: Samb95
12 Replies

9. Shell Programming and Scripting

Creating Log files from Scripts

Hi I would like to create a log file to track the execution of my script. Example, if there were any errors, if it passed or failed etc. How do I go about doing this. My log file will be saved to this location: /var/log/import.log How do I specify the directory? I have been... (1 Reply)
Discussion started by: ladyAnne
1 Replies

10. Shell Programming and Scripting

How to parse large numbers of shell scripts

I am trying to parse hundreds of shell scripts to determine how they related to each other. Ideally for every script, I would get an output of: What other scripts it calls What files it reads Environment variables it accesses Any ideas on how to do this? TIA! (2 Replies)
Discussion started by: bliss
2 Replies
Login or Register to Ask a Question