<?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: Regex Extraction on multiple lines in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595186#M207128</link>
    <description>&lt;P&gt;I will try it out&lt;/P&gt;</description>
    <pubDate>Mon, 25 Apr 2022 12:20:10 GMT</pubDate>
    <dc:creator>chidiuchegbu</dc:creator>
    <dc:date>2022-04-25T12:20:10Z</dc:date>
    <item>
      <title>How to do regex Extraction on multiple lines?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595163#M207114</link>
      <description>&lt;P&gt;I have been avoiding RegEx for quite sometime in Splunk but I now I really need to deal with it and understand it.&lt;/P&gt;
&lt;P&gt;I really need help with this &lt;STRONG&gt;three&lt;/STRONG&gt; cases;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;First Case:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;I have events that usually start with things like 57A,53A and followed by other strings. I want to match 57A but the field value will be&amp;nbsp;FMDKNTLA&lt;/P&gt;
&lt;P&gt;:57A:3232324646&lt;BR /&gt;FMDKNTLA&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Second Case:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Another extraction example will be extracting&amp;nbsp; field &lt;STRONG&gt;31A&lt;/STRONG&gt; but the value will be "&lt;STRONG&gt;NKN&lt;/STRONG&gt;"&lt;/P&gt;
&lt;P&gt;:32A:200117NKN200000000,00&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Third Case:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;extracting field 31A but the value will be "&lt;STRONG&gt;200000000,00&lt;/STRONG&gt;"&lt;/P&gt;
&lt;P&gt;:31A:200117NKN200000000,00&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any help will be appreciated&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 15:27:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595163#M207114</guid>
      <dc:creator>chidiuchegbu</dc:creator>
      <dc:date>2022-04-25T15:27:01Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extraction on multiple lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595172#M207119</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;here is some examples, maybe not the perfect ones as I haven't so enough samples what you have.&lt;/P&gt;&lt;P&gt;1)&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults 
| fields _time
| eval _raw = ":57A:3232324646
FMDKNTLA"
| rex "^:(?&amp;lt;field&amp;gt;[^:]+)"&lt;/LI-CODE&gt;&lt;P&gt;2) &amp;nbsp;I'm exception that you are meaning 32A not 31A? In that case option 1 works also in this case.&lt;/P&gt;&lt;P&gt;3) Also in this case option 1 should work.&lt;/P&gt;&lt;P&gt;&lt;A href="https://regex101.com" target="_blank"&gt;https://regex101.com&lt;/A&gt;&amp;nbsp;is nice place to work &amp;amp; test those.&lt;/P&gt;&lt;P&gt;r. Ismo&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 10:35:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595172#M207119</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2022-04-25T10:35:27Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extraction on multiple lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595175#M207122</link>
      <description>&lt;P&gt;Thanks for the feedback. Yes I have been using regex101.com to learn.&lt;/P&gt;&lt;P&gt;Throwing more light to this. This is a multiple lines of strings of data.The only static field is the 57A,32A but the others are dynamic and changes with data&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For use case 2 and 3&lt;/P&gt;&lt;P&gt;Only 32A is static field but the "NKN" and the digits before and after it changes with each data&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;32A:200117NKN200000000,00&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for use case 1 below, only 57A is constant, "&lt;SPAN&gt;FMDKNTLA" is dynamic and can be "ASTGNMLA" with next data&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;:57A:3232324646&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;FMDKNTLA&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So I want have it extracted as&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;use case 1 - field and field value :&amp;nbsp; &amp;gt;&amp;gt;&amp;gt;57A -&amp;nbsp;FMDKNTLA but can be "57A -&amp;nbsp;ASTGNMLA" next time&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;use case 2 - field and field value: &amp;gt;&amp;gt;&amp;gt;&amp;nbsp;32A - NKN&amp;nbsp; but can be "32A - USD" next time&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;use case 3 - field and field value: &amp;gt;&amp;gt;&amp;gt;&amp;nbsp;32A - 200000000,00&amp;nbsp; but can be "32A - 3400000" next time&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Dont know if this helps&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 11:10:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595175#M207122</guid>
      <dc:creator>chidiuchegbu</dc:creator>
      <dc:date>2022-04-25T11:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extraction on multiple lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595182#M207126</link>
      <description>&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw=":57A:3232324646 FMDKNTLA
:32A:200117NKN200000000,00
:32A:200117NKN200000000,00"
| multikv noheader=t
| table _raw
| eval _raw=replace(_raw," ","
")
``` the lines above set up data as posted ```
| rex ":57A:\d+\s*(?&amp;lt;case1&amp;gt;\w+)"
| rex ":32A:\d+(?&amp;lt;case2&amp;gt;[[:upper:]]+)(?&amp;lt;case3&amp;gt;[\d\,]+)"&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 25 Apr 2022 11:48:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595182#M207126</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-04-25T11:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extraction on multiple lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595186#M207128</link>
      <description>&lt;P&gt;I will try it out&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 12:20:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595186#M207128</guid>
      <dc:creator>chidiuchegbu</dc:creator>
      <dc:date>2022-04-25T12:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extraction on multiple lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595192#M207130</link>
      <description>&lt;P&gt;Hi ITWhisperer,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot. Case 2 and case 3 works but case 1 is not matching. Could you please review again? note that&lt;/P&gt;&lt;P&gt;&amp;nbsp;:57A:3232324646 FMDKNTLA are not on the same line in the logs but like the below&lt;/P&gt;&lt;P&gt;:57A:3232324646&lt;/P&gt;&lt;P&gt;FMDKNTLA&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 12:47:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595192#M207130</guid>
      <dc:creator>chidiuchegbu</dc:creator>
      <dc:date>2022-04-25T12:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extraction on multiple lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595194#M207131</link>
      <description>&lt;P&gt;Note&amp;nbsp; that the number in between ":3232324646 "&amp;nbsp; for case 1 :57A:3232324646 FMDKNTLA&amp;nbsp; should be skipped&amp;nbsp;&lt;/P&gt;&lt;P&gt;only&lt;/P&gt;&lt;P&gt;&amp;nbsp;:57A - FMDKNTLA needed as field and value respectively but again 57A is on a different line from&amp;nbsp;FMDKNTLA&amp;nbsp; represented in the raw log like the below&lt;/P&gt;&lt;P&gt;57A:3232324646&lt;BR /&gt;FMDKNTLA&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 12:52:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595194#M207131</guid>
      <dc:creator>chidiuchegbu</dc:creator>
      <dc:date>2022-04-25T12:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extraction on multiple lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595195#M207132</link>
      <description>&lt;P&gt;That's why I put the replace in when setting up the data to change the space to a new line.&lt;/P&gt;&lt;P&gt;I am assuming the data is still in one event?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 12:54:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595195#M207132</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-04-25T12:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extraction on multiple lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595198#M207133</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ITWhisperer_0-1650891511539.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/19302iC1FD6E77DCFE63D3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ITWhisperer_0-1650891511539.png" alt="ITWhisperer_0-1650891511539.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 12:58:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595198#M207133</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-04-25T12:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extraction on multiple lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595243#M207149</link>
      <description>&lt;P&gt;Thank you. I will try it out again. Though I do not understand fully how it all come together. Its a good place to begin my learning.&lt;/P&gt;&lt;P&gt;Yes the data is on one event with other data --serveral lines , upto 20 lines but the below is the focus of this extraction, while the others will come separately since am not sure if all can in one rex..&lt;/P&gt;&lt;P&gt;.................................................&amp;nbsp;&lt;/P&gt;&lt;P&gt;:53A:/D/3232324646&lt;BR /&gt;FMDKNTLA&lt;BR /&gt;:57A:/D/3123424646&lt;BR /&gt;FTDMNSLA&lt;/P&gt;&lt;P&gt;so I will extract 53A data separately matching to dynamic data "FMDKNTLA" and same with 57A as you have rightly done&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 15:57:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595243#M207149</guid>
      <dc:creator>chidiuchegbu</dc:creator>
      <dc:date>2022-04-25T15:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extraction on multiple lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595245#M207151</link>
      <description>&lt;P&gt;If you can put little explanation to each syntax that will really help&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 15:59:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595245#M207151</guid>
      <dc:creator>chidiuchegbu</dc:creator>
      <dc:date>2022-04-25T15:59:32Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extraction on multiple lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595270#M207156</link>
      <description>&lt;P&gt;OK where did the /D/ come from? That wasn't in your original description of the events - this is why the extract doesn't match for the first case&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 17:07:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595270#M207156</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-04-25T17:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extraction on multiple lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595274#M207158</link>
      <description>&lt;P&gt;Oka it must have been wrongly copied from regex101 as I have been testing this there.&lt;/P&gt;&lt;P&gt;However, this content is entirely dynamic - meaning it can change to anything. So my focus&lt;/P&gt;&lt;P&gt;:57A:&lt;BR /&gt;FIDTNGLA&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 17:28:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595274#M207158</guid>
      <dc:creator>chidiuchegbu</dc:creator>
      <dc:date>2022-04-25T17:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extraction on multiple lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595276#M207160</link>
      <description>&lt;P&gt;rex works by matching strings to find anchors so that strings can be extracted. This relies on there being a pattern. You have now given yet another version of this field. Please can you give more examples (a definitive list?) and explain which part you want extracting.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 17:42:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595276#M207160</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-04-25T17:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extraction on multiple lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595288#M207164</link>
      <description>&lt;P&gt;I did not give another version. am just saying that the certain fields are not static while others are. at the end of the day what I want to extract is&amp;nbsp;&lt;/P&gt;&lt;P&gt;:57A:&lt;BR /&gt;FIDTNGLA&lt;/P&gt;&lt;P&gt;This is a sample event which I posted earlier...This is one event with many strings&lt;/P&gt;&lt;P&gt;:53A:/D/3232324646&lt;BR /&gt;FMDKNTLA&lt;BR /&gt;:57A:/D/3123424646&lt;BR /&gt;FTDMNSLA&lt;/P&gt;&lt;P&gt;So I need 53A as field and&amp;nbsp;FMDKNTLA as the value&amp;nbsp;&lt;/P&gt;&lt;P&gt;and separately needs 57A as the field and&amp;nbsp;FTDMNSLA.&lt;/P&gt;&lt;P&gt;Also there are other lines preceding the events above (same event) but I have successfully extracted them&lt;/P&gt;&lt;P&gt;hope this is clear&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 18:59:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595288#M207164</guid>
      <dc:creator>chidiuchegbu</dc:creator>
      <dc:date>2022-04-25T18:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extraction on multiple lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595300#M207175</link>
      <description>&lt;LI-CODE lang="markup"&gt;| rex ":57A:\S*(?&amp;lt;case1a&amp;gt;\w+)"
| rex ":53A:\S*(?&amp;lt;case1b&amp;gt;\w+)"&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 25 Apr 2022 21:56:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595300#M207175</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-04-25T21:56:59Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extraction on multiple lines</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595360#M207210</link>
      <description>&lt;P&gt;This is still not working and am not sure why. I have just modified sensitive info to paste the full event below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;${1:A29FDDTMLAXXX4444204444}{6:{107:200971602}{441:0}}{1:A29FDDTMLAXXX4444204444}{2:O1092343420017IKNITMLAAXXX45559999999001161692N}{3:{105:NGM}{141:0070}{111:c7837321-c49e-4ccc-b555-05492e60dfd5}{115:1230000}}{6:&lt;BR /&gt;:20:KKNXXX33333333&lt;BR /&gt;:23B:DREM&lt;BR /&gt;:23E:KDVA&lt;BR /&gt;:26T:001&lt;BR /&gt;:32A:200617NKN115003980,00&lt;BR /&gt;:51K:/2222222222&lt;BR /&gt;CAMA TECHNOLOGY COMPANY LIM&lt;BR /&gt;MITED&lt;BR /&gt;:53A:/D/0000024849&lt;BR /&gt;FMDKNTLA&lt;BR /&gt;:57A:/D/0000024946&lt;BR /&gt;FTDMNSLA&lt;BR /&gt;:59:/4440555666&lt;BR /&gt;MITRALO COMPANY&lt;BR /&gt;:71A:OWW&lt;BR /&gt;:72:/COMTYPTN/021&lt;BR /&gt;/BNN/CAMA TECHNOLOGY&lt;BR /&gt;-}{5:{LAC:00000000}{LAC:00000000}{KMK:0000000000}}{S:{KAC:}{DAC:}{WOP:S}}&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 09:00:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-do-regex-Extraction-on-multiple-lines/m-p/595360#M207210</guid>
      <dc:creator>chidiuchegbu</dc:creator>
      <dc:date>2022-04-26T09:00:13Z</dc:date>
    </item>
  </channel>
</rss>

