Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scripting a log

Status
Not open for further replies.

alf2k

Technical User
Dec 12, 2001
9
US
New to perl. anyone have a perl script template
for reading logs and picking only certain
information per line?
don't know where to start.
I am trying to read a log file from Networker and then
pumping the text data out to a SQL server database
any help would be greatly appreciated.

thanks in advance.
 
We should be able to help with that I would think. Why don't you post a couple (and just a couple please :)) of lines from the log file? Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Mike,

Hi! I am not sure if you got the reply I posted last night.
Odd that it doesn't show anywhere.
Anyway, my objective is to pick and choose specific things from each line of a log file and then pipe it out to 2 places - a text file and a SQL server database.
The SQL server I will have to figure out later but if you got something I would also apprecate that. As for the text file a formatted one space delimeted of all the specific things I have chosen from the log. I'm not sure if I have made sense here so let me know. Anyway in the sample below, I only got the successful and unsuccessful messages. Here I would only pick the date, time of the message, start/end time(if the line has one), filename, message why failed/succeeded.

Here's a snippet of the log.
Nov 17 23:51:48 saihsbktst01: NetWorker Savegroup: (notice) test3_1Client completed, 1 client(s) (All Succeeded)
Nov 17 23:51:48 saihsbktst01: Start time: Sat Nov 17 23:45:31 2001
Nov 17 23:51:48 saihsbktst01: End time: Sat Nov 17 23:51:48 2001
Nov 17 23:51:48 saihsbktst01: --- Successful Save Sets ---
Nov 17 23:51:48 saihsbktst01: sagnswbclc02:d:\testfolder2: No save sets with this name were found in the media database; performing a full backup
Nov 17 23:51:48 saihsbktst01: sagnswbclc02: d:\testfolder2 level=full, 412 MB 00:03:59 8 files
Nov 17 23:51:48 saihsbktst01: saihsbktst01: index:sagnswbclc02 level=9, 3 KB 00:00:03 3 files
Nov 17 23:51:48 saihsbktst01: saihsbktst01: bootstrap level=full, 44 KB 00:00:03 8 files
Nov 17 23:51:48 saihsbktst01: * saihsbktst01:bootstrap nsrlpr: Either a printer isn't defined for printing the Bootstrap for this savegroup,
Nov 17 23:51:48 saihsbktst01: * saihsbktst01:bootstrap or the '-PPRINTER' part of the notification resource is absent.
Nov 17 23:51:48 saihsbktst01: * saihsbktst01:bootstrap Please correct as appropriate.
Nov 17 23:51:48 saihsbktst01: * saihsbktst01:bootstrap printing bootstrap information failed (reproduced below).
Nov 17 23:51:48 saihsbktst01: * saihsbktst01:bootstrap
Nov 17 23:51:48 saihsbktst01: * saihsbktst01:bootstrap
Nov 17 23:51:48 saihsbktst01: * saihsbktst01:bootstrap November 17 23:51 2001 saihsbktst01's bootstrap information Page 1
Nov 17 23:51:48 saihsbktst01: * saihsbktst01:bootstrap
Nov 17 23:51:48 saihsbktst01: * saihsbktst01:bootstrap date time level ssid file record volume
Nov 17 23:51:48 saihsbktst01: * saihsbktst01:bootstrap 11/17/2001 full 49694465 6 0 000011
Nov 17 23:51:48 saihsbktst01: * saihsbktst01:bootstrap 11/17/2001 full 49835265 11 0 000011
Nov 17 23:51:48 saihsbktst01: * saihsbktst01:bootstrap 11/17/2001 full 49941249 13 0 000011
Nov 17 23:51:48 saihsbktst01: * saihsbktst01:bootstrap 11/17/2001 full 50819841 18 0 000011
Nov 18 00:00:14 saihsbktst01: NetWorker Savegroup: (notice) test4_2Fastclients completed, 2 client(s) (All Succeeded)
Nov 17 22:54:36 saihsbktst01: NetWorker Savegroup: (alert) test3_1Client completed, 1 client(s) (sagnswbclc02 Failed)
Nov 17 22:54:36 saihsbktst01: Start time: Sat Nov 17 22:50:25 2001
Nov 17 22:54:36 saihsbktst01: End time: Sat Nov 17 22:54:36 2001
Nov 17 22:54:36 saihsbktst01: --- Unsuccessful Save Sets ---
Nov 17 22:54:36 saihsbktst01: * sagnswbclc02:d:\testfolder2 1 retry attempted
Nov 17 22:54:36 saihsbktst01: * sagnswbclc02:d:\testfolder2 Host address mismatch for SAIHSBKTST01
Nov 17 22:54:36 saihsbktst01: * sagnswbclc02:d:\testfolder2 11/17/2001 10:52:01PM nsrexec: Host address mismatch for SAIHSBKTST01
Nov 17 22:54:36 saihsbktst01: * sagnswbclc02:d:\testfolder2 Permission denied
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top