Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-01-2008, 10:48 AM   #1
LQ Newbie
Registered: Mar 2008
Posts: 10

Rep: Reputation: 0
URGENT: Please validate this script

Friends, I work on Cisco routers and switches and dont know much about Scripting. I had to pull the syslogs from 2000 plus routers and swithches and add the device names to the logs after removing not so important messages. i wrote the following in linux and tested it many times without any errors on many dummy syslog messages. but now it has to go live. could someone please validate this please. missing any messages from important devices could be fatal for me.

1) i used grep -v options to remove all non critical syslog messages
2) cat syslog | awk '{print $3 " " $9 " " $10 " " $11 }' > imposyslogs
3) sort and then uniq to get unique messages
4) join inventory syslog > final

* inventory has 2000 devices and its IP addresses

* syslog is 200MB file with around 5000000 messages of the following format

Mar 29 23:19:46.824 GMT: %C4K_IOSMODPORTMAN-4-POWERSUPPLYFANBAD: Fan of power supply 2 has failed
Mar 30 08:19:46.824 JST: %SW_VLAN-3-VLAN_PM_NOTIFICATION_FAILURE: VLAN Manager synchronization failure with Port Manager over port mode change
Mar 10 09:55:22.109 IST: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/38, changed state to up
Mar 10 09:55:24.877 IST: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/38, changed state to down
Mar 10 09:55:46.260 IST: %SYS-2-MALLOCFAIL: Memory allocation of 36688 bytes failed from 0x5E4204, alignment 8

Do you see any chances of failure in this logic? Please let me know if you find any mistakes. I have never run this on a 200MB syslog file
Your comments would be very much appreciated. thanks in advance!
Old 04-01-2008, 11:03 AM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980Reputation: 1980
This is not urgent for us, so please do not mark it as such. It is not on to demand priority attention from a voluntary community.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Urgent : creating folder using bash script prernasin Linux - Newbie 2 09-26-2007 01:58 AM
need urgent help with bash script ferradura Linux - General 4 09-11-2007 04:32 PM
URGENT: script dhcp options nunuschi Programming 4 08-27-2006 08:09 AM
Urgent - Duplicate Script File Colly McKenna Linux - Newbie 8 03-16-2006 01:18 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:48 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration