- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Need Help in a Script
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
Forums
Discussions
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
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
07-10-2001 09:13 AM
07-10-2001 09:13 AM
Need Help in a Script
I want to check possible warning messages from syslog file for the last seven days.
I'm using grep command to match the words like Error, Warning, Fail etc..
This is my command in script.
grep -Ei "err|warn|panic|crit|fail" /var/adm/syslog/syslog.log
I also want to ignore some words those have 'err' letters( Ex.RFErr ) How can I do this in a single grep command??.
And I would like to check syslog file for these errors only for last seven days.
Thanks in Advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 09:18 AM
07-10-2001 09:18 AM
Re: Need Help in a Script
grep -v
See man grep
HTH
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 09:25 AM
07-10-2001 09:25 AM
Re: Need Help in a Script
Modify it as you may want...if you like it.
I set the job up and cron'd it to check the syslog file every 10 minutes...
Regards,
Rita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 09:29 AM
07-10-2001 09:29 AM
Re: Need Help in a Script
cat file |grep -v "word"
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 09:32 AM
07-10-2001 09:32 AM
Re: Need Help in a Script
To check the log file over a specific period of days then you will have to calculate the date "X" days ago, attached is a script which when run as:- <scriptname> x
x being the number of days in the past you require will return that date you can then grep out what you require from that date forward.
Script is one that Tom Danzig posted a while ago. - Thanks Tom.
In your script;-
And so on.
Just an idea
Paula
This scrip was from Tom danzig
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 09:41 AM
07-10-2001 09:41 AM
Re: Need Help in a Script
For grepping errors for last sevendays u need to write a script for that by grepping fileds in date command and decrese the day value for each previous day. You can't do that in single grep command.
I have attached a script for 2 days(today and yesterday.
Cheers...
satish.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 10:26 AM
07-10-2001 10:26 AM
Re: Need Help in a Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 12:40 PM
07-10-2001 12:40 PM
Re: Need Help in a Script
1 ) You can use the find command joint the
mtime parameter for make a copy of file syslog.log older than 7 days.
2 ) Later, use the grep command in this copy.
I Don?t remember the find syntaxe.
Anybody remember ??
more less : find /var/adm/syslog/syslog.log -mtime +7 -exec cp......\;
I hope this help !
Regards,
Abel Berger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 12:46 PM
07-10-2001 12:46 PM
Re: Need Help in a Script
You can use find with -depth. the proper syntex would be
find -depth -mtime +7 -exec
Thanks thou...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2001 11:23 PM
07-10-2001 11:23 PM
Re: Need Help in a Script
will match on "err" or "error" but not, say, "interrupt"
Robin.