- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Tracking log files
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2001 06:39 AM
07-17-2001 06:39 AM
How can i take all the system log files that my hp system creates daily and view them all thru one local file? The files that I want to view in one central file are the following;
/var/adm/sulog
/var/adm/messages
/var/adm/syslog/syslog.log (view last 500 lines)
/var/adm/syslog/mail.log (view last 500 lines)
/var/adm/cron/log (view last 24 hours)
/var/adm/log/backupfs.log (view last 500 lines)
Has anyone done this before? Is there an easy way to do this?
Please advise? thanks,
Chris
chrisam@rocketmail.com
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2001 06:41 AM
07-17-2001 06:41 AM
Re: Tracking log files
Any help is appreciated?
Chris
chrisam@rocketmail.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2001 06:46 AM
07-17-2001 06:46 AM
Solution###begin script
log=/var/adm/logs.tmp
cat /var/adm/sulog > $log
cat /var/adm/messages >> $log
tail -500 /var/adm/syslog/syslog.log >> $log
tail -500 /var/adm/syslog/mail.log >> $log
cat /var/adm/cron/log >> $log
tail -500 /var/adm/log/backupfs.log >> $log
more $log
rm $log
##end script
...jcd...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2001 06:51 AM
07-17-2001 06:51 AM
Re: Tracking log files
An example:
mylogfile=mylogfile.`date +%m%d%Y`
echo "****************/var/adm/sulog****************" > $mylogfile
cat /var/adm/sulog >> $mylogfile
echo "" >> $mylogfile
echo "*******************/var/adm/syslog/syslog.log*********" >> $mylogfile
tail -500 /var/adm/syslog/syslog.log >> $mylogfile
echo "" >> $mylogfile
echo "*******************/var/adm/syslog/mail.log***********" >> $mylogfile
tail -500 /var/adm/syslog/mail.log >> $mylogfile
echo "" >> $mylogfile
echo "*******************/var/adm/cron/log*************" >> $mylogfile
tail -500 /var/adm/cron/log >> $mylogfile
echo "" >> $mylogfile
echo "**************/var/adm/log/backupfs.log**************" >> $mylogfile
tail -500 /var/adm/log/backupfs.log >> $mylogfile
Now you have everything in one file. If you want to e-mail the file to yourself add in the script:
mailx -s "Daily log file report" Your_email@whatever.com < $mylogfile
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2001 06:52 AM
07-17-2001 06:52 AM
Re: Tracking log files
Everything except the cron log is quite easy:
T1=/tmp/myfile
cat var/adm/sulog > $T1
cat /var/adm/messages >> $T1
tail -n 500 /var/adm/syslog/syslog.log >> $T1
tail -n 500 /var/adm/syslog/mail.log >> $T1
tail -n 500 /var/adm/cron/log >> $T1
tail -n /var/adm/log/backupfs.log >> $T1
you can then vi/pg/more /tmp/myfile.
This is not quite the perfect solution since it looks at the last 500 lines of the cron log rather than pattern matching for the first desired date and copying from that point on using awk, sed, perl, ... . I leave that as a student exercise.
Regards, Clay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2001 07:02 AM
07-17-2001 07:02 AM
Re: Tracking log files
I would go with Patricks solution since you also get the headers at the start of each file contents to differentiate between what is what , sincee it will be a lot of Data. My script is also similar to the one.
Manoj Srivastava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2001 07:16 AM
07-17-2001 07:16 AM
Re: Tracking log files
My approach for concatenating the individual files together would be the same. HOWEVER, the 'tail' function has a limited buffer. You will find a 500-line specification is sometimes excessive and you will end up with quite a bit less. You could do the following:
#!/usr/bin/sh
L=`wc -l < /var/adm/syslog/syslog.log`
let L=$L-500
sed "1,${L}d" /var/adm/syslog/syslog.log > /tmp/syslog
In this case, /tmp/syslog will truly contain the last 500 lines of the original.
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-17-2001 08:43 AM
07-17-2001 08:43 AM
Re: Tracking log files
Try using xlogmaster.
http://www.gnu.org/software/xlogmaster/