- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- grep latest time messages from the syslog
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
тАО11-09-2003 07:59 AM
тАО11-09-2003 07:59 AM
grep latest time messages from the syslog
In the syslog there are several times "named restart" messages, but I want to grep the latest
time "named restart" messages from the syslog.
The question is how?? I want to grep the messages which starts with "starting (/etc/named.conf)" and end on Ready "to anwser queries"
e.g.
Nov 20 11:53:01 dns2 named[21345]: starting (/etc/named.conf). named 8.2.5-T1A
etc..etc..
etc..
etc..etc.
Nov 20 11:53:02 dns2 named[21346]: Ready to answer queries.
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-09-2003 08:28 AM
тАО11-09-2003 08:28 AM
Re: grep latest time messages from the syslog
Last 50. You can run this through grep if there is anything you are looking for.l
tail 50 /var/adm/syslog/syslog.log | grep -i error
tail -f /var/adm/syslog/syslog.log
continuous stream as they happen. I keep this in a terminal window when I suspect a system is getting ready to make trouble.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-09-2003 08:46 AM
тАО11-09-2003 08:46 AM
Re: grep latest time messages from the syslog
Because I don't know where exactly it happenes.
I want to search throught the whole syslog to grep the latest "named restart".
not only one syntax/line, but all data from "starting..." to "Read"...y.
//john
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-09-2003 11:56 AM
тАО11-09-2003 11:56 AM
Re: grep latest time messages from the syslog
hth,
Hein.
#!/usr/bin/perl
while (<>) {
if (/named\[\d+\]: start/) {
undef @x;
$go = 1;
}
push (@x, $_) if ($go);
$go = 0 if (/named\[\d+\]: Ready/);
}
print foreach (@x);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-09-2003 07:30 PM
тАО11-09-2003 07:30 PM
Re: grep latest time messages from the syslog
awk '
BEGIN {linescaught=0}
$0 ~ /named/ && $0 ~ /starting/ { # Start of text
split ("", namedlines) # Empty the array
capturing = 1
linescaught = 0
}
(capturing > 0) {namedlines[++linescaught] = $0}
$0 ~ /named/ && $0 ~ /Ready/ { # End of text
capturing = 0
}
END { for (i=1;i<=linescaught;i++) print (namedlines[i]) }
' /var/adm/syslog/syslog.log
-- Graham