- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to trim the logfiles with active process w...
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
11-03-2010 01:37 AM
11-03-2010 01:37 AM
How to trim the logfiles with active process writing to?
Thanks, Aldis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2010 02:00 AM
11-03-2010 02:00 AM
Re: How to trim the logfiles with active process writing to?
How about using only the ">" symbol.
Eg.
# > /var/adm/syslog/syslog.log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2010 02:12 AM
11-03-2010 02:12 AM
Re: How to trim the logfiles with active process writing to?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2010 02:19 AM
11-03-2010 02:19 AM
Re: How to trim the logfiles with active process writing to?
#!/bin/sh
export today=`date -u +%b%d`
cd /var/adm/syslog
#
cat syslog.log |grep Logging |mailx -s "trim syslog" root
# Copy active file to old directory
cat syslog.log >./old.syslog/$today.syslog
cat mail.log >./old.maillog/$today.maillog
# Initialize active file
>syslog.log
>mail.log
# Delete file(s) older than 120 days from old directory
find /var/adm/syslog/old.syslog/ -mtime +120 -exec rm {} \;
find /var/adm/syslog/old.maillog/ -mtime +120 -exec rm {} \;
Hope this will help you.
Prashant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2010 02:24 AM
11-03-2010 02:24 AM
Re: How to trim the logfiles with active process writing to?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2010 02:28 AM
11-03-2010 02:28 AM
Re: How to trim the logfiles with active process writing to?
Try copying /dev/null over the log file. Also see if you can find any option in sam.
Refer:
http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1033864
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2010 02:34 AM
11-03-2010 02:34 AM
Re: How to trim the logfiles with active process writing to?
Can u share the output of below commands
1)pwd ( where '>'not working )
2)echo $SHELL
3)ll /var/adm/syslog/syslog.log
4)id
5)check bdf output, if any filsystem reach 99%
Prashant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2010 02:45 AM
11-03-2010 02:45 AM
Re: How to trim the logfiles with active process writing to?
the cp /dev/null
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2010 02:46 AM
11-03-2010 02:46 AM
Re: How to trim the logfiles with active process writing to?
Any application or OS?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2010 02:47 AM
11-03-2010 02:47 AM
Re: How to trim the logfiles with active process writing to?
If the writer is tracking where he thinks the file position is and writes to that position, you can't change that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2010 03:08 AM
11-03-2010 03:08 AM
Re: How to trim the logfiles with active process writing to?
Still i need to find a way to trim those files as the users keep the sessions open for several days and the logfiles grow fast. Please advise!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2010 04:19 AM
11-03-2010 04:19 AM
Re: How to trim the logfiles with active process writing to?
# > filename
or:
# cat /dev/null > filename
If no process is using the file, it will be reduced to a size of zero.
If a process is using the file, then this will return disk blocks to the system but will not change the length of the file that the process with the file open "sees". Rather the file will be sparse with nulls at its beginning. This is generally not an issue for log files.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2010 05:14 AM
11-03-2010 05:14 AM
Re: How to trim the logfiles with active process writing to?
Does rootsh accept a HUP signal?
# mv logfile logfile-old
(the logfile-old is still open and written to)
# kill -HUP rootsh-PID
(The -HUP signal *might* make the rootsh start a new logfile under the original name)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2010 12:51 PM
11-03-2010 12:51 PM