- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Scripting
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
09-20-2004 08:49 AM
09-20-2004 08:49 AM
Scripting
I need to extract all entries logged for the last 15 Minutes from syslog starting from current time .How can I do it in a shell script.
Thanks in advance
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2004 08:54 AM
09-20-2004 08:54 AM
Re: Scripting
tail -20 /var/adm/syslog/syslog
to see the last entries.
If you are planning on feeding this into a program, then that me stickier...
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2004 09:00 AM
09-20-2004 09:00 AM
Re: Scripting
My requirement is to get entries which are logged in last 15 Minutes.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2004 09:17 AM
09-20-2004 09:17 AM
Re: Scripting
Note: The script requires perl binary in the system.
typeset -i CUR=0
CUR=$(/usr/bin/perl -e '{print (time())}')
(( FIFTEEN_MIN_BEFORE = CUR - (15*60) ))
DATE_TO_GREP=$(echo "0D${FIFTEEN_MIN_BEFORE}=Y" | adb | awk '{print $2,$3,$4}' | awk -F: '{print $1":"$2}')
grep "^${DATE_TO_GREP}" /var/adm/syslog/syslog.log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-20-2004 04:15 PM
09-20-2004 04:15 PM
Re: Scripting
--------------------------------
#!/usr/bin/sh
set -x
# Execute with minute < ./script 15>
IN=${1:-15}
SYSLOG=/var/adm/syslog/syslog.log
if [[ ! -f $SYSLOG ]]
then
echo "No $SYSLOG file there"
exit 1
fi
Day=$(date +'%b %d')
hour=$(date +"%H")
min=$(date +"%M")
now=$(echo $hour:$(echo $min | cut -c 1))
if [[ $min -lt $IN ]]
then
let hh=$hour-1
let mm=60+$min-$IN
before=$(echo $hh:$mm)
else
let mm=$min-$IN
let hh=$hour
before=$(echo $hh:$(echo $mm | cut -c 1))
fi
grep "$Day" $SYSLOG | grep -E "${before}[0-9]*|${now}[0-9]*"
-----------------------------
I have tried to collect the informations on syslog between time frame now and before 15 minutes there ...