- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- rotating syslog
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
10-14-2002 06:49 AM
10-14-2002 06:49 AM
rotating syslog
- Tags:
- syslog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2002 06:53 AM
10-14-2002 06:53 AM
Re: rotating syslog
1.Make a back up copy of the /sbin/init.d/syslogd file in a temporary location.
2.Edit the file /sbin/init.d/syslogd
# vi /sbin/init.d/syslogd
3.Locate the line for the ???start??? case. Inside the logic for the start case, there should be a command line of the form
mv /var/adm/syslog/syslog.log /var/adm/syslog/OLDsyslog.log
4.Change this line to
mv /var/adm/syslog/syslog.log /var/adm/syslog/OLDsyslog.log.`date +%b%d%Y_%H%M`
5.Save the file
:wq!
6.During the next reboot, verify that the previous syslog.log in the /var/adm/syslog directory is being backed up as OLDsyslog.log.MDY_HM and not as OLDsyslog.log, where M is the abbreviated month name, D is the date, Y is the year in century format, H is the hour (in 24 hour format) and M is the minute.
7.During multiple reboots, the old syslog files will thus be saved separately each time and not get overwritten. The /var filesystem must therefore be watched for disk space usage over a period of time.
This concludes the task for changing the /sbin/init.d/syslogd file to save old syslog.log files over multiple reboots.
Backout:
1.Restore the /sbin/init.d/syslogd file from the temporary location where it was stored in Step 1 of the above Procedure.
2.During a subsequent reboot of the server, verify that /var/adm/syslog.log is being backed up as /var/adm/syslog/OLDsyslog.log.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2002 06:54 AM
10-14-2002 06:54 AM
Re: rotating syslog
ll |sort -r -k5,5 |head -n 20
Share and Enjoy! Ian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2002 06:58 AM
10-14-2002 06:58 AM
Re: rotating syslog
For finding the bigger 20 files in a directory :
ll /your/directory | sort -r -k 5 | awk -v i=20 '{ if ( i>0 ) print $0 ; i=i-1 }'
Regards,
Tibi Baraboi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2002 07:05 AM
10-14-2002 07:05 AM
Re: rotating syslog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2002 12:02 PM
10-14-2002 12:02 PM
Re: rotating syslog
I like to break up the syslog facilities into separate log files. The syslog.conf will look like this:
kern.debug /var/adm/syslog/kern.log
user.debug /var/adm/syslog/user.log
mail.debug /var/adm/syslog/mail.log
daemon.debug /var/adm/syslog/daemon.log
auth.debug /var/adm/syslog/auth.log
syslog.debug /var/adm/syslog/syslog.log
lpr.debug /var/adm/syslog/lpr.log
news.debug /var/adm/syslog/news.log
uucp.debug /var/adm/syslog/uucp.log
cron.debug /var/adm/syslog/cron.log
local0.debug /var/adm/syslog/local0.log
local1.debug /var/adm/syslog/local1.log
local2.debug /var/adm/syslog/local2.log
local3.debug /var/adm/syslog/local3.log
local4.debug /var/adm/syslog/local4.log
local5.debug /var/adm/syslog/local5.log
local6.debug /var/adm/syslog/local6.log
local7.debug /var/adm/syslog/local7.log
*.emerg *
*.alert root
I use a posix shell script to locate each log file in a specified directory, move it into a date structured tree (.../OLD/facility/YYYY/MM/DD.HHMMSS), touch a new log file, and send SIGHUP to syslogd when all files have been rotated. The script is attached. It is run by root cron one minute before midnight every day.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2002 12:29 AM
10-15-2002 12:29 AM
Re: rotating syslog
big:
#!/sbin/sh
du -sk $1 | sort -rn | head -20
#The End.
example:
$ big *og*
10611 XtermLog.23068
4845 XtermLog.16187
3583 XtermLog.20340
2898 XtermLog.01600
369 XtermLog.24973
330 XtermLog.23379
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2002 12:33 AM
10-15-2002 12:33 AM
Re: rotating syslog
See on this link:
http://www.introcomp.co.uk/examples/index.html
lots of examples.
C.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2002 09:32 AM
10-15-2002 09:32 AM
Re: rotating syslog
datetest=`date +%A`
date=Friday
if [[ $datetest = $date ]]
then
cp /var/adm/syslog/syslog.log /var/adm/syslog/syslog.log`date '+%d.%m.%y_%H:%M'`
>/var/adm/syslog/syslog.log
echo "-------------The syslog has been moved and reduced------------------" >> datafile