in reply to Re: DateTime::Format::Flexible; for Log Parse with multiple formatted lines
in thread DateTime::Format::Flexible; for Log Parse with multiple formatted lines
I now understand about the Data Portion and this looks good. Boss doesn't like it... says his script was better because was more simple. I still would like to use and modify this one (thank you) but I am having a problem with breaking up the $rest. trying to add in my first with the positions but its not working correctly. I am thinking that the $dts has extra left over that is being pushed out and making $rest not the same. But I probably don't have the code correct
if (/^\d{4,}-[\d\-T\:\.]+(?=\s+)/p) { my ($dts,$rest) = (${^MATCH}, ${^POSTMATCH}); my $dt = $strp_one->parse_datetime($dts); # parse "$rest" and break it into more fields here while ($rest =~ /(\w+\s+)(\w+\s+)(.+?)/smg) { print "New Error Found...\n"; print "0 $0\n"; print "1 $1\n"; print "2 $2\n"; print "3 $3\n"; print "4 $4\n"; print "5 $5\n"; print "6 $6\n";} $csv->print(select, [ $dt->strftime('%Y-%m-%d,%H:%M:%S'),#'%Y-%m-%d-%H-%M-%S-%6N +-%Z' $rest ] ); }
I did add full data strings
__DATA__ 2017-02-20T09:30:53.177000 20848[30892] 0000000000000000 [DM_ +MQ_I_DAEMON_START]info: "Message queue daemon (tid : 27944, session +0102b20d80000456) is started sucessfully." 2017-02-20T09:30:53.193000 20848[17732] 0102b20d80000003 [DM_ +DOCBROKER_I_PROJECTING]info: "Sending information to Docbroker locat +ed on host (PWDOCPRDCON32) with port (1489). Information: (Config(se +rver), Proximity(1), Status(Open), Dormancy Status(Active))." 2017-02-20T09:30:53.193000 20848[17732] 0102b20d80000003 [DM_ +DOCBROKER_I_PROJECTING]info: "Sending information to Docbroker locat +ed on host (server) with port (1354). Information: (Config(server), +Proximity(2), Status(Open), Dormancy Status(Active))." 2017-02-20T09:30:53.193000 20848[17732] 0102b20d80000003 [DM_ +DOCBROKER_I_PROJECTING]info: "Sending information to Docbroker locat +ed on host (server) with port (1354). Information: (Config(Server), +Proximity(3), Status(Open), Dormancy Status(Active))." Mon Feb 20 09:31:25 2017 [INFORMATION] [AGENTEXEC 26816] Detected duri +ng program initialization: Version: 7.2.0160.0297 Win64 Mon Feb 20 09:31:30 2017 [INFORMATION] [AGENTEXEC 26816] Detected duri +ng program initialization: Agent Exec connected to server server: [D +M_SESSION_I_SESSION_START]info: "Session 0102b20d80397508 started fo +r user user."
I do need to pull out the word position (info:) as it would say error: if a problem but add back in for full message DM...info: "message.." and thats what I need.
2084817732 and 0102b20... are not needed as well as INFORMATION and agentexect 26816
so what did I do wrong with the code in trying to find the positions?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: DateTime::Format::Flexible; for Log Parse with multiple formatted lines
by haukex (Archbishop) on Mar 27, 2017 at 14:54 UTC | |
by TCLion (Novice) on Mar 27, 2017 at 17:08 UTC | |
by haukex (Archbishop) on Mar 27, 2017 at 18:07 UTC | |
by poj (Abbot) on Mar 27, 2017 at 20:18 UTC | |
by 1nickt (Canon) on Mar 27, 2017 at 17:35 UTC |