- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- shell script for log rotation
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
Discussions
Discussions
Discussions
Forums
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
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
тАО01-04-2006 05:55 PM
тАО01-04-2006 05:55 PM
I want to rotate a log file based on its size. Does anyone has any shell script for this ?
Regards,
Shiv
Solved! Go to Solution.
- Tags:
- logrotate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2006 06:00 PM
тАО01-04-2006 06:00 PM
Solutiondo u have logrotate:
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/logrotate-2.5/
regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-04-2006 06:09 PM
тАО01-04-2006 06:09 PM
Re: shell script for log rotation
see:
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/logrotate-2.5/
this tool is designed to ease administration of systems that generate large numbers of log files. It allows automatic rotation, compression, removal, and mailing of log files. Each log file may be handled daily, weekly, monthly, or when it grows too large.
hope this helps!
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-05-2006 01:46 AM
тАО01-05-2006 01:46 AM
Re: shell script for log rotation
Mine is configured like so:
/etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 5
# create new (empty) log files after rotating old ones
create
# uncomment this if you want your log files compressed
#compress
# packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp -- we'll rotate them here
/var/adm/wtmp {
monthly
create 0664 adm adm
rotate 1
}
In /etc/logrotate.d dir, I have maillog and syslog.
# cat syslog
/var/adm/syslog/syslog.log {
rotate 5
weekly
postrotate
/usr/bin/kill -HUP `ps -ef |grep syslogd |awk '{print $2}'` || true
endscript
}
# cat maillog
/var/adm/syslog/mail.log {
rotate 5
weekly
}
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-05-2006 02:40 AM
тАО01-05-2006 02:40 AM
Re: shell script for log rotation
Once per week, per month, daily, etc...
I like to rotate by month - I keep the previous 2 months on the system with older logs being on 2 different monthly backups.
Each will have a name that describes its contents and from when. Example, 'sulog.Dec2005', 'sulog.Nov2005', 'syslog.Dec2005', etc...
I know the time frames so I know which archived log file to look for.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-05-2006 02:44 PM
тАО01-05-2006 02:44 PM
Re: shell script for log rotation
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=938732
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-05-2006 08:35 PM
тАО01-05-2006 08:35 PM
Re: shell script for log rotation
If you prefer a shell script, here a good ksh script found on this forum some time ago.(Sorry, I forgot the name of the author). It rotate log files based on size, lifespan, It allow compression, manage the "old" files log generated by the system (eg OLDsyslog.log vs syslog.log), the number of copies to maintain, the security parameters to be applied to the files with chmod and chown. It is very simple, easy to adapt and deserves to be examined.
Regards, Joel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-16-2008 02:49 PM
тАО10-16-2008 02:49 PM
Re: shell script for log rotation
Just want to say that the attached script by Joel above works very well in our hpux system.
Thanks!
Michael