- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Syslog purging
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
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
тАО05-03-2009 09:33 PM
тАО05-03-2009 09:33 PM
My syslog file is too large. I want to copy the lines by date wise like "Apr 1 to May 4".
Please suggest me.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-03-2009 10:57 PM
- Tags:
- sed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2009 12:23 AM
тАО05-04-2009 12:23 AM
Re: Syslog purging
just copy the file into other name
#cd /var/adm/syslog
#cp syslog.log syslog.old
vi syslog.old
go to the desire line
press Esc :,$d
it will remove all below lines from the cursor position.
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2009 03:08 AM
тАО05-04-2009 03:08 AM
Re: Syslog purging
> I want to copy the lines by date wise like "Apr 1 to May 4".
This suggests that these are the lines you actually want to _preserve_ in your 'syslog'.
You could simply 'vi' the current '/var/adm/syslog/syslog.log' deleting everything before this range begins.
You could, as Dennis suggested, use something like 'sed' to match and print lines in that region to a new file.
If you chose to redirect output to a new file, like 'syslog.latest' or 'syslog.new' and then wish to _replace_ the contents of the "real" syslog file with it:
Do _NOT_ use 'mv' to replace the old file with the new file. Instead, use 'cp' to keep the current file associated with the current 'syslogd' process. If you erroneously 'mv' a new file over the old one, you will find that further logging will not occur until you restart the 'syslogd' daemon.
If you examine the "start" action of '/sbin/init.d/syslogd' you will see that a restart of the 'syslogd' daemon is made following a 'mv' [rename] of the current 'syslog' to 'OLDsyslog'.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2009 03:27 AM
тАО05-04-2009 03:27 AM
Re: Syslog purging
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2009 06:36 PM
тАО05-04-2009 06:36 PM
Re: Syslog purging
>ME: You'll need to find the exact format for Apr 1 from the syslog file.
Oops, slight problem, that should have a -n!
In mine, there is one space after the month and for one digit dates, there is an extra space.
I assume you don't have to worry about no syslog entries for Apr 1? ;-)
For partial months, you could use:
sed -n -e '/^Apr /,$p/' syslog.log
This picks the first entry for April, even if you rebooted on Apr 15.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2009 06:39 PM
тАО05-04-2009 06:39 PM
Re: Syslog purging
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2009 08:32 PM
тАО05-04-2009 08:32 PM