Need to develop a script to create a report reading multiple server logs


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need to develop a script to create a report reading multiple server logs
# 1  
Old 02-24-2011
Need to develop a script to create a report reading multiple server logs

I am currently trying to develop a script to connect to mulltiple servers, reading specifc data from log files on the servers and append the data from each file into a single tab delimited row. So, at the end I am planning to have a report with all the extracted data with each row per server. I am trying to understand if I can login to each of these servers and be able to write the extracted data to a single remote file, or if I need to generate a file for each server with a single row of extracted data and scp all of them back to the source server inorder to be able to build the report. Any suggestions, pointers,etc will be really appreciated.
# 2  
Old 02-24-2011
1. set ssh passwordless for each remote server.

2. update and run the script:

Code:
while read server
do
  ssh $server  "grep DATE /XXX/remote_log_file " > local_log_file
done < server.list

# 3  
Old 03-18-2011
Currently I have deviced a logic , to have files generated on individual servers, which will pulled over to the central server and appended to one large file, which will be emailed as a report. I am currently stuck at place where, I need the following output in a file:
Code:
/dev/emcpowera1      636382720 236480640 399902080  38% /datatransY
                     1252757932 337580588 851540864  29% /datatransXX/XXXXXXX1
                     626371912 161135116 433418864  28% /datatransXX/XXXXXXX5

I am trying to remve the other datafileds and modify file to only have the filesystem names,
Code:
/datatransXX/XXXXXXX1/datatransXX/XXXXXXX5

so that, I can use the filestems using a variable in my logic. I am trying to find only the strings to match, /datatrans**/ to be the output.

Any ideas will be really appreciated.

Thanks

Last edited by Scott; 03-21-2011 at 03:40 PM..
# 4  
Old 03-19-2011
Code:
$ cat infile

/dev/emcpowera1 636382720 236480640 399902080 38% /datatransY
1252757932 337580588 851540864 29% /datatransXX/XXXXXXX1
626371912 161135116 433418864 28% /datatransXX/XXXXXXX5

$ awk '/datatrans/{print $NF}' infile

# 5  
Old 03-21-2011
Hi rdcwayx,
I have tried it and it seems to work for me and the following is the output:
Code:
$ awk '/datatrans**/{print $NF}'awk filesystem.txt
/datatransb
/datatransn1/XXXXXXX1
/datatransn1/YYYYYYY5

The thing is , I need to implement it in multiple locations/servers.The strings XXXXXXX1/YYYYYYY5 will vary but will always end with a number. Is there a filter I can set while using the awk command, to exclude /datatransb and only get the output for the anything that has a string like XXXXXXX1 ending with a number?

Thanks

Last edited by Scott; 03-21-2011 at 03:39 PM.. Reason: Code tags
# 6  
Old 03-21-2011
Code:
awk '/datatrans.*[0-9]$/{print $NF}' infile

This User Gave Thanks to ctsgnb For This Post:
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 - Asterisk logs report

Dear all, I start to build script(s) for few tasks, and I'll use log files to complete the following: 1) when ringnoanswer for a particular operator hits count 10 for waittime > 14000 send mail alert with summary of calls 2) per queue - exitwithtimout > 1 in any hour, then send mail... (12 Replies)
Discussion started by: bigbrobg
12 Replies

2. Shell Programming and Scripting

Need to develop a bash script to create customized report from the server log

Hi, I need to develop a bash script to create customized report from the server log (red hat 5.8 64 bit Operating system). The following is one of the log for our internal application task. <2015.03.03 20:09:52 274 +0800><I><DSCTH01><http-0.0.0.0-443-2><security> GUI request succeeded for... (1 Reply)
Discussion started by: pugazhendhi_r
1 Replies

3. Shell Programming and Scripting

Shell Script for viewing multiple logs from multiple server

I am new to Shell scripting and below is my requirement. I need to search some specific word e.g. "exception" or "transaction" from log file. We have multiple env e.g. Level1 , Level2 etc and each env have Multiple boxes e.g. For Level 1 env we have "test11.test.com" , "test12.test.com". Each... (1 Reply)
Discussion started by: peeyush
1 Replies

4. Shell Programming and Scripting

Perl script to parse multiple windows event logs.

Hi all, I am developing a log parsing agent in perl to send windows Event logs to Zenoss Monitoring tool. Using Win32::EventLog i can able to get the Event messages but only one Eventype eg Application or System could able to parse at a time. Can you please help to how to open mutiple eventlogs... (3 Replies)
Discussion started by: kar_333
3 Replies

5. Shell Programming and Scripting

Need help: Script to report timestamp of directories in a specific path from multiple Linux server

Need help Please help on how to write a script which can echo timestamp, size of subdirectories in a specific path from multiple Linux servers to a text file. I can ssh with a common user to all the servers from a build box. Basic idea what I had was: ssh <commonuser>@<each box> cd... (1 Reply)
Discussion started by: sudhichadaga
1 Replies

6. Shell Programming and Scripting

script for reading logs of a script running on other UNIX server

Hi, I have a script, running on some outside firwall server and it's log of success or failure is maintained in a file. I want to write a script which ftp that server and reads that file and checks the logs and if failure , I will send mail notification. Please let meknow if I am not... (1 Reply)
Discussion started by: vandana.parwani
1 Replies

7. Shell Programming and Scripting

Create a script that executes when a user attempts to delete history logs

Hi, I have a linux redhat 9 server and I am concerned about the security on that server. I would like to be able to write a script that records all the commands that were typed at the command prompt before the user calls the 'history -c' command and deletes all the history. I was thinking about... (4 Replies)
Discussion started by: mishkamima
4 Replies

8. Shell Programming and Scripting

Create Multiple files by reading a input file and changing the contents

Being new to this area .I have been assigned a task which i am unable to do . Can any one please help me . Hi I have requirement where i have input file XYZ_111_999_YYYYMMDD_1.TXT and with header and series of Numbers and Footer. I want to create a mutiple output files with each file having a... (2 Replies)
Discussion started by: bhargavkr
2 Replies

9. Shell Programming and Scripting

Shell script to view logs of a server

Please share a shell script to collect logs of a server (like cpu utilization, memory etc) for a perticular time interval by giving date, time and server name as input. (1 Reply)
Discussion started by: abhishek27
1 Replies

10. UNIX for Dummies Questions & Answers

Reading input to create a variable in a script?

I would like to prompt for input and then use it as a variable in a script. Something like this. #!/bin/ksh echo "What is your name?: \c" read response echo "Your name is $reply" >file.txt done exit 0 What am I missing? Thanks, (7 Replies)
Discussion started by: darthur
7 Replies
Login or Register to Ask a Question