- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Creating Multiple syslog.log Versions
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
12-31-2002 05:11 AM
12-31-2002 05:11 AM
Thanks,
Yosef Rosenblatt
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2002 05:26 AM
12-31-2002 05:26 AM
Re: Creating Multiple syslog.log Versions
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2002 05:28 AM
12-31-2002 05:28 AM
Re: Creating Multiple syslog.log Versions
#!/bin/sh
#
# Roll over the syslogd log files
#
PATH=/bin:/usr/bin
SYSLOGCONF=/etc/syslog.conf
PIDFILE=/var/run/syslogd.pid
OLDDIR=/var/log/.oldlogs
LIM_SIZE=300
main()
{
echo "Rotating syslog log files:"
LOGFILES=`sed -n '
/^#/d
/^$/d
s/[^ ]*[ ]*\(\/.*\)/\1/p' < $SYSLOGCONF | sort | uniq | egrep -v '^(/dev/|@)'`
for FILE in ${LOGFILES}
{
if [ -f $FILE ]; then
eachfile $FILE
fi
}
echo sending SIGHUP to syslogd
kill -1 `cat $PIDFILE`
}
eachfile()
{
size=`sum $1 | awk '{print $2}'`
if [ $size -ge $LIM_SIZE ]; then
echo "Rotating $1 file."
roll5 $1
fi
}
roll()
{
if [ -f "$1" ]; then
mv "$1" "$2"
fi
}
roll5()
{
TAIL=`echo $1 | sed 's/.*\///'`
OLDLOG="${OLDDIR}/${TAIL}"
roll "$OLDLOG".4 "$OLDLOG".5
roll "$OLDLOG".3 "$OLDLOG".4
roll "$OLDLOG".2 "$OLDLOG".3
roll "$OLDLOG".1 "$OLDLOG".2
roll "$1" "$OLDLOG".1
cp /dev/null $1
chmod 644 $1
}
main ${1+"$@"}
exit 0
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2002 05:29 AM
12-31-2002 05:29 AM
Re: Creating Multiple syslog.log Versions
Also, check this recent thread:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x0cd47680e012d71190050090279cd0f9,00.html
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2002 05:30 AM
12-31-2002 05:30 AM
Re: Creating Multiple syslog.log Versions
First thing is to make a backup copy of the /sbin/init.d/syslogd file to syslogd.bak.
edit the syslogd file and change where the syslog.log file is moved to OLDsyslog.log to change it to syslog.log with the date appended to it:
if [ -x /usr/sbin/syslogd -a -f /etc/syslog.conf ]; then
if [ -f /var/adm/syslog/syslog.log ]; then
mv /var/adm/syslog/syslog.log /var/adm/syslog/syslog.log.$(date
+%Y%m%d).$(date +%H%M%S)
Hope this helps
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2002 05:35 AM
12-31-2002 05:35 AM
Re: Creating Multiple syslog.log Versions
Again thanks,
Yosef
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2002 05:40 AM
12-31-2002 05:40 AM
Re: Creating Multiple syslog.log Versions
For this reason I need something that is not a manual process but is built into the way the o/s handles its shutdown procedures.
Thanks,
yosef
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2002 05:44 AM
12-31-2002 05:44 AM
SolutionEvery time your system panics and subsequently comes up and starts up syslogd, instead of renaming syslog.log to OLDsyslog.log, it renames it with a unique date/timestamed syslog.log
Hope this clears up my previous post.
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2002 05:52 AM
12-31-2002 05:52 AM
Re: Creating Multiple syslog.log Versions
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2002 05:53 AM
12-31-2002 05:53 AM
Re: Creating Multiple syslog.log Versions
I wrote my second question before i read your answer. I just tested it and it works perfectly. Thanks a lot.
Yosef