<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Extract field from a complex multi-lines event from log file in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Extract-field-from-a-complex-multi-lines-event-from-log-file/m-p/272776#M190195</link>
    <description>&lt;P&gt;It works like a charm.&lt;BR /&gt;
Thanks Woodcock,&lt;/P&gt;</description>
    <pubDate>Wed, 01 Jun 2016 04:27:38 GMT</pubDate>
    <dc:creator>langlv</dc:creator>
    <dc:date>2016-06-01T04:27:38Z</dc:date>
    <item>
      <title>Extract field from a complex multi-lines event from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-field-from-a-complex-multi-lines-event-from-log-file/m-p/272773#M190192</link>
      <description>&lt;P&gt;Hi pros,&lt;BR /&gt;
I am new with Splunk and trying to analyze a complex log file from a financial application. I want to figure out the fields from a multilines event, here is my log example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;16.02.10 09:20:53 [ FromIso:123456789]************** INBOUND MESSAGE ID[AAABqgAwV0ujhQAA] ***************
 in[ 48: ]&amp;lt;800&amp;gt;
 in[ 48: ]&amp;lt;8220000100000000&amp;gt;
 in[ 48: ]&amp;lt;0400000000000000&amp;gt;
msgno[  0]&amp;lt;800&amp;gt;
Bitmap: [82200001000000000400000000000000]
 in[  7: ]&amp;lt;530&amp;gt;
 in[  7: ]&amp;lt;92833&amp;gt;
 in[ 11: ]&amp;lt;694437&amp;gt;
 in[ 32: ]&amp;lt;6&amp;gt;
 in[ 32: ]&amp;lt;123123&amp;gt;
 in[ 70: ]&amp;lt;2&amp;gt;
D-ISO-0306: m0800/a0000000000/t694437/p000000/r00
16.02.10 09:20:53 [   ToIso:123456789]************** OUTBOUND MESSAGE ID[AAABqgAwV0ujhQAA] ***************
msgno[  0]&amp;lt;810&amp;gt;
Bitmap: [82200001020000000400000000000000]
out[ 48: ]&amp;lt;0810&amp;gt;
out[ 48: ]&amp;lt;8220000102000000&amp;gt;
out[ 48: ]&amp;lt;0400000000000000&amp;gt;
out[  7: ]&amp;lt;0530&amp;gt;
out[  7: ]&amp;lt;092833&amp;gt;
out[ 11: ]&amp;lt;694437&amp;gt;
out[ 32: ]&amp;lt;06&amp;gt;
out[ 32: ]&amp;lt;123123&amp;gt;
out[ 39: ]&amp;lt;00&amp;gt;
out[ 70: ]&amp;lt;002&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to extract the fields msgno=800/810 and field39="00" from the log above.&lt;/P&gt;

&lt;P&gt;I tried to use Field Extractor to extract those fields but no luck.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Lang&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2016 02:58:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-field-from-a-complex-multi-lines-event-from-log-file/m-p/272773#M190192</guid>
      <dc:creator>langlv</dc:creator>
      <dc:date>2016-05-31T02:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: Extract field from a complex multi-lines event from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-field-from-a-complex-multi-lines-event-from-log-file/m-p/272774#M190193</link>
      <description>&lt;P&gt;Probably the best way is to use EXTRACTs in props.conf with the following regexes;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;msgno[^&amp;lt;]+(?&amp;lt;msgno&amp;gt;\d+)
\s39:\s\]\&amp;lt;(?&amp;lt;field39&amp;gt;\d+)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You should probably check the documentation regarding EXTRACT &lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.1/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles"&gt;http://docs.splunk.com/Documentation/Splunk/6.4.1/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Also, it may be worth checking out the &lt;CODE&gt;rex&lt;/CODE&gt; command, which lets you perform regex-based field extractions as part of the search query. At least it is simpler for trying out new extraction patterns before committing them to a config file.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;/k&lt;/P&gt;</description>
      <pubDate>Tue, 31 May 2016 09:50:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-field-from-a-complex-multi-lines-event-from-log-file/m-p/272774#M190193</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2016-05-31T09:50:47Z</dc:date>
    </item>
    <item>
      <title>Re: Extract field from a complex multi-lines event from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-field-from-a-complex-multi-lines-event-from-log-file/m-p/272775#M190194</link>
      <description>&lt;P&gt;At search time, like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rex max_match=99 "msgno\[\s*\d+\]&amp;lt;(?&amp;lt;msgno&amp;gt;\d+)&amp;gt;"
    | rex max_match=99 "out\[\s*39:\s*\]&amp;lt;(?&amp;lt;field39&amp;gt;\d+)&amp;gt;"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 May 2016 13:18:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-field-from-a-complex-multi-lines-event-from-log-file/m-p/272775#M190194</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-05-31T13:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: Extract field from a complex multi-lines event from log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Extract-field-from-a-complex-multi-lines-event-from-log-file/m-p/272776#M190195</link>
      <description>&lt;P&gt;It works like a charm.&lt;BR /&gt;
Thanks Woodcock,&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2016 04:27:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Extract-field-from-a-complex-multi-lines-event-from-log-file/m-p/272776#M190195</guid>
      <dc:creator>langlv</dc:creator>
      <dc:date>2016-06-01T04:27:38Z</dc:date>
    </item>
  </channel>
</rss>

