- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- 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
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
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
09-25-2013 05:26 AM
09-25-2013 05:26 AM
log rotation
Hi ,
I want to perform some log rotation.
Just for simple,I have put all those in find command in a file and I will execute the file using cron.
find /tmp -type f -name "*.log" -mtime +3 -exec /usr/bin/gzip {} \;
zipped file will be removed after 10 days
find /tmp -type f -name "*.log.gz" -mtime +100 -exec rm -rf {} \;
is my understanding correct or any other method to perform log rotation.
- Tags:
- logrotate
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2013 09:48 AM
09-25-2013 09:48 AM
Re: log rotation
>find /tmp -type f -name "*.log" -mtime +3 -exec /usr/bin/gzip {} \;
(You really shouldn't have logs in /tmp, if that's not just an example.)
You can speed this up by using: -exec /usr/bin/gzip {} +
>zipped file will be removed after 10 days
You have 100 below.
>find /tmp -type f -name "*.log.gz" -mtime +100 -exec rm -rf {} \;
Since you have "-type f", you should just use: -exec rm -f {} +
>is my understanding correct or any other method to perform log rotation.
Seems fine. Have you looked into logrotate?