#!/usr/local/bin/perl use warnings; use strict; use English; use Data::Dumper; use Time::HiRes 'time'; my $logfile; my $dateRegex = qr/\d{4}-\d\d-\d\d \d\d:\d\d:\d\d:\d\d\d/; my $parse_log_entry = qr/^($dateRegex.*?)(?=$dateRegex)/ms; { # "slurp" the entire log file into memory at once local $INPUT_RECORD_SEPARATOR; $logfile = ; } my $count = 0; # Initialize counter my $start = time(); # Start the timer while( $logfile =~ m/$parse_log_entry/g ) { $count++; # count number of parsed strings } my $end = time(); # Stop the timer my $elapsed = $end - $start; # How long did that take? my $average = $elapsed/$count; # Average processing time printf "Parsed $count log file entries in %.4f seconds, averaging %.4f\n", $elapsed, $average; exit; __DATA__ 2004-01-05 22:37:48:879 : xscWnpStation_WNP_N_1 : EXCEPTION : ResourceLimitation CLH0070E CANNOT ROUTE NPANXX OF 801-750-1742 (FAX) msg_id: pOm94rLCG2CC39dj TRACKINID=200402043229577 : REQ_NO=62320402446422 : REQ_INSTANCE=0020 : NNSP=6232 : ONSP=6875 : NLSP=6232 : OLSP=null : MSGTYPE=NOT 2004-01-05 22:38:52:019 : xscWnpStation_WNP_N_1 : dbError : SMGWNP0007 Database related error. : in xscPortResponse_PRI: Cannot find a confirmed request for SUP3 msg_id: pOm94vILG2CCIthy TRACKINID=200402013135093 : REQ_NO=65290402734448 : REQ_INSTANCE=0002 : NNSP=6529 : ONSP=6006 : NLSP=null : OLSP=6006 : MSGTYPE=PRI 2004-01-05 22:43:02:239 : xscWnpStation_WNP_N_1 : EXCEPTION : InputDataValidationError MPE2099E RESP NUM ON SUP MUST MATCH RESP NUM ON RESPONSE msg_id: 23f1bb:fa87b0edab:-4347 TRACKINID=200312312021455 : REQ_NO=62320312334661 : REQ_INSTANCE=0050 : NNSP=6232 : ONSP=6529 : NLSP=6232 : OLSP=6529 : MSGTYPE=NOT 2004-02-05 22:37:48:879 : xscWnpStation_WNP_N_1 : EXCEPTION : ResourceLimitation CLH0070E CANNOT ROUTE NPANXX OF 801-750-1742 (FAX) msg_id: pOm94rLCG2CC39dj TRACKINID=200402043229577 : REQ_NO=62320402446422 : REQ_INSTANCE=0020 : NNSP=6232 : ONSP=6875 : NLSP=6232 : OLSP=null : MSGTYPE=NOT 2004-02-05 22:38:52:019 : xscWnpStation_WNP_N_1 : dbError : SMGWNP0007 Database related error. : in xscPortResponse_PRI: Cannot find a confirmed request for SUP3 msg_id: pOm94vILG2CCIthy TRACKINID=200402013135093 : REQ_NO=65290402734448 : REQ_INSTANCE=0002 : NNSP=6529 : ONSP=6006 : NLSP=null : OLSP=6006 : MSGTYPE=PRI 2004-02-05 22:43:02:239 : xscWnpStation_WNP_N_1 : EXCEPTION : InputDataValidationError MPE2099E RESP NUM ON SUP MUST MATCH RESP NUM ON RESPONSE msg_id: 23f1bb:fa87b0edab:-4347 TRACKINID=200312312021455 : REQ_NO=62320312334661 : REQ_INSTANCE=0050 : NNSP=6232 : ONSP=6529 : NLSP=6232 : OLSP=6529 : MSGTYPE=NOT 2004-02-05 22:43:50:769 : xscWnpStation_WNP_N_1 : dbError : SMGWNP0007 Database related error. : (Error Without Msg) In getRecordForSoaByTn: tracking_id not found for TN: 7145246400; REQ_NO: 652904017079; OWNER: 6529 2004-02-05 22:44:51:979 : xscWnpStation_WNP_N_1 : EXCEPTION : InputDataValidationError MPE0600E DUE DATE/TIME MUST EQUAL DESIRED DUE DATE/TIME TO CONFIRM REQUEST msg_id: pOm94t8TG2CDiqMP TRACKINID=200402053272708 : REQ_NO=621404024940585 : REQ_INSTANCE=0001 : NNSP=6214 : ONSP=9740 : NLSP=null : OLSP=9740 : MSGTYPE=PRO 2004-02-05 22:47:12:879 : xscWnpStation_WNP_N_1 : dbError : SMGWNP0007 Database related error. : (Error Without Msg) In getRecordForSoaByTn: tracking_id not found for TN: 6193022949; REQ_NO: 652904027361; OWNER: 6529 2004-02-05 22:49:50:059 : xscWnpStation_WNP_N_1 : dbError : SMGWNP0007 Database related error. : in xscDB_WnpPortResponse.insert: ORA-01400: cannot insert NULL into ("DBADMIN"."WNP_PORT_RESPONSE"."MESSAGE_TIMESTAMP") msg_id: pOm94nEIG2CEtKQd TRACKINID=200401092311869 : REQ_NO=65290401599145 : REQ_INSTANCE=0002 : NNSP=6529 : ONSP=6664 : NLSP=null : OLSP=6664 : MSGTYPE=PR2 2004-02-05 22:49:50:079 : xscWnpStation_WNP_N_1 : messageError : SMGWNP0009 Internal Message Error. : xscPortResponse_CLH_PR2 exception: xscDB_WnpPortResponse: caught SQL Exception during insertion: ORA-01400: cannot insert NULL into ("DBADMIN"."WNP_PORT_RESPONSE"."MESSAGE_TIMESTAMP") msg_id: pOm94nEIG2CEtKQd TRACKINID=200401092311869 : REQ_NO=65290401599145 : REQ_INSTANCE=0002 : NNSP=6529 : ONSP=6664 : NLSP=null : OLSP=6664 : MSGTYPE=PR2