<?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 Looking for a regex that extract key=values from same line in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Looking-for-a-regex-that-extract-key-values-from-same-line/m-p/528872#M149328</link>
    <description>&lt;P&gt;Application log file display below at one of the line, looking for a regex that extract value of "0" / "1" / "2" or "3" in to a variables, which can be used later to draw a line chart&lt;/P&gt;&lt;P&gt;Splunk item Total: [ 0=233 ]&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;Splunk item Total: [ 1=220 ]&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;Splunk item Total: [ 1=220 3=40 ]&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;Splunk item Total: [ 0=50 1=210 3=30 ]&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;Splunk item Total: [ 0=100 1=205 2=10&amp;nbsp; 3=5 ]&lt;/P&gt;</description>
    <pubDate>Tue, 10 Nov 2020 19:02:03 GMT</pubDate>
    <dc:creator>YagneshShah1</dc:creator>
    <dc:date>2020-11-10T19:02:03Z</dc:date>
    <item>
      <title>Looking for a regex that extract key=values from same line</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Looking-for-a-regex-that-extract-key-values-from-same-line/m-p/528872#M149328</link>
      <description>&lt;P&gt;Application log file display below at one of the line, looking for a regex that extract value of "0" / "1" / "2" or "3" in to a variables, which can be used later to draw a line chart&lt;/P&gt;&lt;P&gt;Splunk item Total: [ 0=233 ]&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;Splunk item Total: [ 1=220 ]&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;Splunk item Total: [ 1=220 3=40 ]&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;Splunk item Total: [ 0=50 1=210 3=30 ]&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;Splunk item Total: [ 0=100 1=205 2=10&amp;nbsp; 3=5 ]&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2020 19:02:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Looking-for-a-regex-that-extract-key-values-from-same-line/m-p/528872#M149328</guid>
      <dc:creator>YagneshShah1</dc:creator>
      <dc:date>2020-11-10T19:02:03Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a regex that extract key=values from same line</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Looking-for-a-regex-that-extract-key-values-from-same-line/m-p/528891#M149330</link>
      <description>&lt;P&gt;Using your example data, run this query - is that what you wanted in the rex statement?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval fields=split("Splunk item Total: [ 0=233 ],Splunk item Total: [ 1=220 ],Splunk item Total: [ 1=220 3=40 ],Splunk item Total: [ 0=50 1=210 3=30 ],Splunk item Total: [ 0=100 1=205 2=10  3=5 ]",",")
| mvexpand fields
| table fields
| rex field=fields max_match=0 "(?&amp;lt;key&amp;gt;\d+)=(?&amp;lt;value&amp;gt;\d+)"&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 10 Nov 2020 21:33:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Looking-for-a-regex-that-extract-key-values-from-same-line/m-p/528891#M149330</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2020-11-10T21:33:07Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a regex that extract key=values from same line</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Looking-for-a-regex-that-extract-key-values-from-same-line/m-p/528896#M149333</link>
      <description>&lt;P&gt;Sorry I confuse you, actually log is printing sometime this&amp;nbsp;&lt;/P&gt;&lt;P&gt;Splunk item Total: [ 0=233 ]&lt;/P&gt;&lt;P&gt;or sometime this&amp;nbsp;&lt;/P&gt;&lt;P&gt;Splunk item Total: [ 1=220 ]&lt;/P&gt;&lt;P&gt;and looking for a regex that capture in variable "zero" value 233 and in variable "one" value 220 than I will use variable "zero" and "one&amp;nbsp; to print line graph&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2020 23:03:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Looking-for-a-regex-that-extract-key-values-from-same-line/m-p/528896#M149333</guid>
      <dc:creator>YagneshShah1</dc:creator>
      <dc:date>2020-11-10T23:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a regex that extract key=values from same line</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Looking-for-a-regex-that-extract-key-values-from-same-line/m-p/528901#M149334</link>
      <description>&lt;P&gt;Try using extract command (works on field _raw). A runanywhere example is here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval raw=split("Splunk item Total: [ 0=233 ],Splunk item Total: [ 1=220 ],Splunk item Total: [ 1=220 3=40 ],Splunk item Total: [ 0=50 1=210 3=30 ],Splunk item Total: [ 0=100 1=205 2=10  3=5 ]",",")
| mvexpand raw | rename raw as _raw 
| extract kvdelim="=" pairdelim=" " auto=t clean_keys=false&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 11 Nov 2020 00:07:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Looking-for-a-regex-that-extract-key-values-from-same-line/m-p/528901#M149334</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-11-11T00:07:04Z</dc:date>
    </item>
    <item>
      <title>Re: Looking for a regex that extract key=values from same line</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Looking-for-a-regex-that-extract-key-values-from-same-line/m-p/529001#M149348</link>
      <description>&lt;P&gt;I cannot use any of this in extract&lt;/P&gt;&lt;P&gt;(Splunk item Total: [ 0=233 ],Splunk item Total: [ 1=220 ],Splunk item Total: [ 1=220 3=40 ],Splunk item Total: [ 0=50 1=210 3=30 ],Splunk item Total: [ 0=100 1=205 2=10 3=5 ])&lt;/P&gt;&lt;P&gt;as I have mentioned it is not constant it changes, logs sometime display&lt;/P&gt;&lt;P&gt;Splunk item Total: [ 0=233 ]&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;Splunk item Total: [ 1=220 ]&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;Splunk item Total: [ 1=220 3=40 ]&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;Splunk item Total: [ 0=50 1=210 3=30 ]&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;Splunk item Total: [ 0=100 1=205 2=10 3=5 ]&lt;/P&gt;&lt;P&gt;Only think I am interested is if it had "0=" than like to extract that value if it display "1=" than like to extract that value if it display "0=" and "1=" than like to extract both value&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2020 15:49:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Looking-for-a-regex-that-extract-key-values-from-same-line/m-p/529001#M149348</guid>
      <dc:creator>YagneshShah1</dc:creator>
      <dc:date>2020-11-11T15:49:45Z</dc:date>
    </item>
  </channel>
</rss>

