- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: log rotation by command >
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
08-15-2005 09:37 PM
08-15-2005 09:37 PM
Thanks,
Shiv
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2005 09:39 PM
08-15-2005 09:39 PM
Re: log rotation by command >
the > logfilename is a redirect of output command.
Please clarify your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2005 09:41 PM
08-15-2005 09:41 PM
Re: log rotation by command >
that do not rotate the log file (or any file for that matter). it will "null" or empty the file, i.e. create a zero-length file.
# man null
for more info.
regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2005 09:46 PM
08-15-2005 09:46 PM
Re: log rotation by command >
Well,
With time logfiles become very large in size and slowly they can occupy your whole filesystem.
So its a good convention after sometime you start using the same logfile.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2005 10:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2005 10:11 PM
08-15-2005 10:11 PM
Re: log rotation by command >
Do not get confused as Leif mentionned > will overwrite what was there previously to append to you would need >>
Now as for rotating logs you would use your own custum scripts or tool like logrotate:
http://hpux.connect.org.uk/hppd/hpux/Sysadmin/logrotate-2.5/
All the best
Victor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2005 10:11 PM
08-15-2005 10:11 PM
Re: log rotation by command >
cp /var/adm/syslog/syslog.log /var/adm/syslog/syslog.log.`date +%d%m%y`
> /var/adm/syslog/syslog.log
This copies the contents of the file to a dated file then empties the existing log. You would probably also compress the dated log.
The reason you can't just move the file is that because the file is open (by the syslog daemon in this case), the file even though renamed still gets written to.
A process when opening a file attaches to the inode (underlying pointer), so when you rename a file the inode remains the same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2005 10:19 PM
08-15-2005 10:19 PM
Re: log rotation by command >
I have a file open for writing then simply doing a cat terminates that process.
Here you truncating the whole file which is still open.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2005 12:55 AM
08-16-2005 12:55 AM
Re: log rotation by command >
--->I have a file open for writing then simply doing a cat terminates that process.
Not in every case. Sometimes even when you remove the file , the process will keep on. Also it will not release the blocks occupied by such file and the process needs to be terminated manually if you need to get the free space.
>logfilename works for any file you need to null out and not only for the logfiles. This redirects the null to the content of the file, inturn making it a zero byte file.
The samething will be achived by 0>filename.
HTH,
Devender