- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Can't reduce log file size with "cat /dev/null"
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
тАО10-04-2010 04:42 AM
тАО10-04-2010 04:42 AM
Can't reduce log file size with "cat /dev/null"
I have a log file which increased file size every 5 seconds but there is no log rotation function with this log file. I want to clean up this log with "cat /dev/null > log_file" but the file size was back to original after next 5 seconds. The application can't be stop. How do I clean up this log file?
Thanks
- Tags:
- logfile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2010 04:52 AM
тАО10-04-2010 04:52 AM
Re: Can't reduce log file size with "cat /dev/null"
You need to fix the application to do less logging or live with a large log file.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2010 05:01 AM
тАО10-04-2010 05:01 AM
Re: Can't reduce log file size with "cat /dev/null"
Unless the application is cooperating, it will continue to write to where it thinks the file pointer is, not back to 0.
The application will have to be rewritten, either to close and open the file or to open it append?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-04-2010 05:03 AM
тАО10-04-2010 05:03 AM
Re: Can't reduce log file size with "cat /dev/null"
Solution ,somehow you have to find what is the root cause and decide whether or not stop it,
you can use ps -ef | grep -i
and kill it ,if you can find.
OR use lsof to see if there is open and running script suspected to cause this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-05-2010 01:18 AM
тАО10-05-2010 01:18 AM
Re: Can't reduce log file size with "cat /dev/null"
Thanks ! It looks like no other way to rotate this log manually except changing AP. I just wonder if this log really occupies such disk space as it shows or it just a dummy file size.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-05-2010 04:09 AM
тАО10-05-2010 04:09 AM
Re: Can't reduce log file size with "cat /dev/null"
> I just wonder if this log really occupies such disk space as it shows or it just a dummy file size.
If you mean is it a sparse file, you could compare the size as seen by 'ls' and 'du'. If the 'du' size (multiplied by 512, since that is the block size unit) is substantially different from a simple 'ls' the file is sparse. If you copy (with 'cp' the file and its size inflates, that's another indication that the file is sparse).
Whether or not the application is creating a sparse file, a shell redirection will truncate it. As Dennis hinted, that doesn't stop the application from seeking to where ever it "thinks" is wants its end-of-file pointer to be before a subsequent write.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-05-2010 04:18 AM
тАО10-05-2010 04:18 AM
Re: Can't reduce log file size with "cat /dev/null"
Moving (renaming) a file won't fix the problem until the application closes the file. When the file is open, you even remove (rm) the file and the space will not be reclaimed (and the no-name logfile will continue to grow) until the application stops.
As far as space goes, the ll command (ll /tmp/logfilename) shows allocated (directory entry) space while du (du -k /tmp/logfilename) will show occupied space. Since most logfiles are normally created serially (appended), the occupied and allocated space should be the same.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-05-2010 05:24 AM
тАО10-05-2010 05:24 AM
Re: Can't reduce log file size with "cat /dev/null"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-05-2010 11:10 AM
тАО10-05-2010 11:10 AM
Re: Can't reduce log file size with "cat /dev/null"
I tried to duplicate this with stdio using several different fopen modes and I wasn't successful.
Perhaps using tusc would tell us if there was a lseek before the write.