<?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 Regex Extraction in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Regex-Extraction/m-p/535467#M9635</link>
    <description>&lt;P&gt;HI All,&lt;/P&gt;&lt;P&gt;PLease help in extracting the below logs as per the conditions stated&lt;/P&gt;&lt;P&gt;key1=value1,key2=value2\,key 3=value3\,value4\,value5\,value6\,key4={key5=value5\,key6= value6\,},key7=val10(key8=val11\,key9=val12),key20=val20&lt;/P&gt;&lt;P&gt;i have a log of the above format&lt;/P&gt;&lt;P&gt;i want to extract key value pairs without backslash&lt;/P&gt;&lt;P&gt;also&amp;nbsp;key 3=value3\,value4\,value5\,value6\,&amp;nbsp; is a multivalue field and should be extracted&amp;nbsp; as&amp;nbsp; :-&lt;/P&gt;&lt;P&gt;key 3=value3,value4,value5,value6&lt;/P&gt;&lt;P&gt;and&amp;nbsp;key4={key5=value5\,key6= value6\,}, is a json object&amp;nbsp; which should be extracted as:-&lt;/P&gt;&lt;P&gt;&amp;nbsp; key5= value5 , key6= value 6(i.e key 4={ should not be extracted)&lt;/P&gt;&lt;P&gt;&amp;nbsp;and key7=val10(key8=val11\,key9=val12) should be extracted individually as :-&lt;/P&gt;&lt;P&gt;key7=val10 ,key8=val11,key9=val12&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 12 Jan 2021 12:11:17 GMT</pubDate>
    <dc:creator>bhavneeshvohra9</dc:creator>
    <dc:date>2021-01-12T12:11:17Z</dc:date>
    <item>
      <title>Regex Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Regex-Extraction/m-p/535467#M9635</link>
      <description>&lt;P&gt;HI All,&lt;/P&gt;&lt;P&gt;PLease help in extracting the below logs as per the conditions stated&lt;/P&gt;&lt;P&gt;key1=value1,key2=value2\,key 3=value3\,value4\,value5\,value6\,key4={key5=value5\,key6= value6\,},key7=val10(key8=val11\,key9=val12),key20=val20&lt;/P&gt;&lt;P&gt;i have a log of the above format&lt;/P&gt;&lt;P&gt;i want to extract key value pairs without backslash&lt;/P&gt;&lt;P&gt;also&amp;nbsp;key 3=value3\,value4\,value5\,value6\,&amp;nbsp; is a multivalue field and should be extracted&amp;nbsp; as&amp;nbsp; :-&lt;/P&gt;&lt;P&gt;key 3=value3,value4,value5,value6&lt;/P&gt;&lt;P&gt;and&amp;nbsp;key4={key5=value5\,key6= value6\,}, is a json object&amp;nbsp; which should be extracted as:-&lt;/P&gt;&lt;P&gt;&amp;nbsp; key5= value5 , key6= value 6(i.e key 4={ should not be extracted)&lt;/P&gt;&lt;P&gt;&amp;nbsp;and key7=val10(key8=val11\,key9=val12) should be extracted individually as :-&lt;/P&gt;&lt;P&gt;key7=val10 ,key8=val11,key9=val12&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 12:11:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Regex-Extraction/m-p/535467#M9635</guid>
      <dc:creator>bhavneeshvohra9</dc:creator>
      <dc:date>2021-01-12T12:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Regex-Extraction/m-p/535495#M9636</link>
      <description>&lt;P&gt;Regular expressions like to work with consistent data.&amp;nbsp; So, are these keys always the same and always in the same order?&amp;nbsp; Are any of them optional?&lt;/P&gt;&lt;P&gt;Can you go back to the developers and ask them to log in a more consistent format, like all-JSON or all K=V?&amp;nbsp; Something like this would be far easier to parse.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;key1=value1;key2=value2;key 3=value3,value4,value5,value6;key5=value5;key6= value6;key7=val10;key8=val11;key9=val12;key20=val20&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 15:15:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Regex-Extraction/m-p/535495#M9636</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-01-12T15:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Regex-Extraction/m-p/535496#M9637</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;Thank you for your response .. it is not possible to change the data format&lt;/P&gt;&lt;P&gt;everything in the log format is&amp;nbsp; in forms of key value pairs like key1= val1&lt;/P&gt;&lt;P&gt;but&amp;nbsp; for some keys there is a '\'gettinga dded ti the values like key2=val2\,&lt;/P&gt;&lt;P&gt;also there are some keys having multiple values like key3=val3\,val4\,val5\,&amp;nbsp; &amp;nbsp;for which we need extarction like key3=val3,val4,val5&lt;/P&gt;&lt;P&gt;also there are scenarios where its in form of object like key4= {key5=val5\, key6=val6},&lt;/P&gt;&lt;P&gt;for which we only need the values inside { like--&amp;gt; key5= val5 and key6= val6&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 15:22:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Regex-Extraction/m-p/535496#M9637</guid>
      <dc:creator>bhavneeshvohra9</dc:creator>
      <dc:date>2021-01-12T15:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Regex-Extraction/m-p/535507#M9638</link>
      <description>&lt;P&gt;Thank you for restating the problem.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regular expressions like to work with consistent data.&amp;nbsp; So, are these keys always the same and always in the same order?&amp;nbsp; Are any of them optional?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 16:38:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Regex-Extraction/m-p/535507#M9638</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2021-01-12T16:38:26Z</dc:date>
    </item>
    <item>
      <title>Re: Regex Extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Regex-Extraction/m-p/535528#M9639</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/50809"&gt;@bhavneeshvohra9&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Can you try following? The only change you should do is "key_3" field name. I needed to use second transform for multi-value fields. I hope multi-value field names are specific.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;props.conf
[your_sourcetype]
REPORT-kv = extract_kv, extract_mv
EVAL-key_3 = split(replace(key_3,"\\\\",""),",")
KV_MODE = none

transforms.conf
[extract_mv]
FORMAT = key_3::$1
REGEX = key\s3=(.+?),\w+=

[extract_kv]
FORMAT = $1::$2
REGEX = ([^=,{\s]+)=([^=,\\{()]+)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jan 2021 17:22:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Regex-Extraction/m-p/535528#M9639</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-01-12T17:22:44Z</dc:date>
    </item>
  </channel>
</rss>

