Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help Consolidating Logs

Status
Not open for further replies.
Apr 2, 2002
25
US
OK... I have to console logs from two different machines (solaris 8) and I need to take console log 1 and append it to cosole log 2 name it with the date (like console####.gz where #### is the current date) zip it and move it to another server. Any one know of the best way or a script that can do this ?

Thanks for the help !
 
Something like this?

Code:
#!/bin/bash

today=`date +%e%b%Y`;
echo 'log1:' > console$today;
cat log1 >> console$today;
echo 'log2:' >> console$today;
cat log2 >> console$today;

That'll give you a file called 'console25Apr2002' (today it will, anyway!) which will contain:
log1:
[log 1 contents]
log2:
[log 2 contents]

Hope it helps. Matt
matt@paperlove.org
If I can help, I will.
 
Oh, forgot the zippage... Add
Code:
gzip console$today;
as the last line and it'll zip it.
To get it to another server, you can add
Code:
scp console$today.gz user@host:directory
or similar. Matt
matt@paperlove.org
If I can help, I will.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top