Need in for a script that should check for errors in multiple log file (approx 2500) and should mail

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Need in for a script that should check for errors in multiple log file (approx 2500) and should mail
# 1  
Old 04-25-2017
Need in for a script that should check for errors in multiple log file (approx 2500) and should mail

hello everyone,

I am new to linux and got this deliverable to write a script that should check for error in multiple log file (count is approx 2500 log files on single server) and once error is found, it should mail that error

My logic says:
we can put all log files path/location in one FILE and we can implement for loop to read single file from FILE and search for error and if error is found , will append in different output file and iterating for loop to read every log file in FILE and once all files are searched, then mailx output file

Could you please help me in implementing above idea or if you have any convenient way, please share.

Looking for help from scriptors

Thanks in advance.
# 2  
Old 04-25-2017
Moderator's Comments:
Mod Comment I am moving this thread discussing a technical problem from the How to Post in the The UNIX and Linux Forums forum to a forum intended for technical discussions...


Knowing how your log file are named and where they are located might provide a better means of getting a list of files to process than manually creating a file containing 2500 pathnames).

Knowing what operating system and shell you're using might help us determine whether or not the operating system you're using has tools to perform these kinds of specialized searches built-in.

Knowing the format of your log files and how you are able to determine whether or not they contain indications that an error occurred will be crucial to determine what kind of processing needs to be performed to achieve your goal.

Samples of log files and the output you hope to produce from those samples would be a huge help if you want suggestions on how to process your log files.

Without basic information like those things listed above, we can make lots of wild guesses that might not be of any help at all.
# 3  
Old 04-26-2017
Is that a homework question? Those should be posted in Homework & Coursework Questions filling in the correct form to its entirety according to the forum rules.

If this is not a homework assignment, please explain the company or project you work for and the nature of the problem you are working on.

In either case, please show us what you have tried so far to solve this problem on your own, using (CODE) tags where applicable.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check file if not found send mail if exit call second script

I need to check my script and change to working mode. currently it was not sending the mail and exit without calling the second script. I need to check the file is present ="/home/Rvtools/test.csv" if this file not found after the time retry send mail file not found If the file exit run the... (2 Replies)
Discussion started by: ranjancom2000
2 Replies

2. Shell Programming and Scripting

Shell script to check current date file is created and with >0 kb or not for multiple directories

Hi All, I am new in scripting and working in a project where we have RSyslog servers over CentOS v7 and more than 200 network devices are sending logs to each RSyslog servers. For each network devices individual folders create on the name of the each network devices IP addresses.The main... (7 Replies)
Discussion started by: Pinaki
7 Replies

3. Shell Programming and Scripting

How to catch errors in a shell script ( multiple commands )?

Hi I have a shell script like that Main() { DAY=$(date +"%d-%m-%Y") TIME=$(date +"%T") Command 1 Command 2 ... Command n } I would like to catch errors from all commands in Main() and write these errors into a file , something likes this: Main if < error > then echo... (3 Replies)
Discussion started by: bobochacha29
3 Replies

4. UNIX for Dummies Questions & Answers

Check file size and mail

Hi, I am trying to write a script which will check if the filesize is grather than 0 KB, compress the file and send to the email list else if the file size is zero KB don't send a mail update the log if then echo "Validate the file" | mailx -s " There are errors : " ${EMAIL_LIST} else... (5 Replies)
Discussion started by: mora
5 Replies

5. Shell Programming and Scripting

File check script fails for multiple files

I want to check if any file with testing*.txt exists but my script fails if more than 1 file exists. It works fine for a single file if then echo "TEST21" fi -------------- bash: How do I fix this? Thanks Please use code tags next time for your code and data. (8 Replies)
Discussion started by: sumang24
8 Replies

6. Shell Programming and Scripting

Shell script for creating log file and sending mail?

Hi , I am trying to create shell script which will help me to compare file name in two folder. There is a multiple file store in 2 folder.I want to compare that with the name. If all the file are same then send a mail that "all date is same" if not then create one log file which contain... (4 Replies)
Discussion started by: san_dy123
4 Replies

7. Shell Programming and Scripting

Need script to pull multiple field from log file

I am hoping to get some help with a script to pull certain fields from a log file. User update (xx6xxx P) rpt (yy6yyy B) 2010/01/20 21:36:01.298 Remote client forward start streamid 85af 2010/01/20 21:36:01.307 rpt2 (ZZ6ZZZ G) rpt1 (YY6YYY B) urcall (CQCQCQ ) mycall (W1AW) user... (5 Replies)
Discussion started by: TedSD
5 Replies

8. Shell Programming and Scripting

How to automatically send a mail alert if the script errors out

I have a script like this, which calls other scripts from that script: #!/usr/ksh moveFiles.sh extract.sh readfile=/home/sample.txt cat $readfile | while read line do file= `echo $line|awk '{print $4}'` if ; then mv $file /home/temp_stage fi (4 Replies)
Discussion started by: ss3944
4 Replies

9. Shell Programming and Scripting

check the file in multiple Directory in a script

hi, i want to write the script to list atleast one file inside that directory eg: /home/Log/amp01 /home/log/amp02 . . . /home/log/amp..N want to see atleast one file inside the /home/log/amp01 .... amp(N) if it not there.. need to give that no file exists inside... (3 Replies)
Discussion started by: mail2sant
3 Replies

10. Shell Programming and Scripting

Schedule a script to check mail?

Hi, I'd like to somehow schedule a task on my webserver, such that my account's mail is checked every 10-15 minutes and: a) any new e-mails received from a particular address are POST-ed to a PHP webpage on my server. b) any new e-mails received from a different particular address are... (2 Replies)
Discussion started by: stujones
2 Replies
Login or Register to Ask a Question