<?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: How to extract key-value pairs from log and visualize them in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pairs-from-log-and-visualize-them/m-p/594223#M206816</link>
    <description>&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="My-Application Log: Some-Key= 99, SomeOtherKey= 231, SomeOtherKey2= 1231, Some Different Key= 0, Another Key= 121"
``` use rex to extract kv pairs ```
| rex max_match=0 "(?&amp;lt;namevalue&amp;gt;\w[\w\s\-]+=\s[^,]+)"
``` streamstats to tag each event so that the fields can be gathered together ```
| streamstats count as _row
``` expand the kv pairs to separate events ``` 
| mvexpand namevalue
``` split names and values ```
| rex field=namevalue "(?&amp;lt;_name&amp;gt;[^=]+)\=\s(?&amp;lt;_value&amp;gt;.*)"
| fields - namevalue
``` create new fields for each name with corresponding value ```
| eval {_name}=_value
``` gather fields back to original events ```
| stats values(_time) as _time values(*) as * by _row&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 19 Apr 2022 08:55:32 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2022-04-19T08:55:32Z</dc:date>
    <item>
      <title>How to extract key-value pairs from log and visualize them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pairs-from-log-and-visualize-them/m-p/594216#M206814</link>
      <description>&lt;P&gt;&lt;SPAN&gt;My logs are in the format:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;My-Application Log: Some-Key= 99, SomeOtherKey= 231, SomeOtherKey2= 1231, Some Different Key= 0, Another Key= 121&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I currently use query:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;index="myindex" "My-Application Log:" | extract pairdelim=",&amp;nbsp; " kvdelim="= " | table&amp;nbsp;Some-Key&amp;nbsp; SomeOtherKey&amp;nbsp;SomeOtherKey2 "Some Different Key" "Another Key"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It is able to extract events however the table is filled with blank/null values.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How can i visualise the data if i have this format of logs.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I have to group by Some-key.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Example visualization should be grouped basis Some-key&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 08:35:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pairs-from-log-and-visualize-them/m-p/594216#M206814</guid>
      <dc:creator>arnavkumarsaxen</dc:creator>
      <dc:date>2022-04-19T08:35:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract key-value pairs from log and visualize them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pairs-from-log-and-visualize-them/m-p/594223#M206816</link>
      <description>&lt;LI-CODE lang="markup"&gt;| makeresults
| eval _raw="My-Application Log: Some-Key= 99, SomeOtherKey= 231, SomeOtherKey2= 1231, Some Different Key= 0, Another Key= 121"
``` use rex to extract kv pairs ```
| rex max_match=0 "(?&amp;lt;namevalue&amp;gt;\w[\w\s\-]+=\s[^,]+)"
``` streamstats to tag each event so that the fields can be gathered together ```
| streamstats count as _row
``` expand the kv pairs to separate events ``` 
| mvexpand namevalue
``` split names and values ```
| rex field=namevalue "(?&amp;lt;_name&amp;gt;[^=]+)\=\s(?&amp;lt;_value&amp;gt;.*)"
| fields - namevalue
``` create new fields for each name with corresponding value ```
| eval {_name}=_value
``` gather fields back to original events ```
| stats values(_time) as _time values(*) as * by _row&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 19 Apr 2022 08:55:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pairs-from-log-and-visualize-them/m-p/594223#M206816</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-04-19T08:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract key-value pairs from log and visualize them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pairs-from-log-and-visualize-them/m-p/594232#M206818</link>
      <description>&lt;P&gt;Works for me. However, i am new to splunk and i might have a small question.&lt;/P&gt;&lt;P&gt;The value from the last field contains \n" and sometimes \n"}&lt;/P&gt;&lt;P&gt;How to remove this as well.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 09:59:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pairs-from-log-and-visualize-them/m-p/594232#M206818</guid>
      <dc:creator>arnavkumarsaxen</dc:creator>
      <dc:date>2022-04-19T09:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract key-value pairs from log and visualize them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pairs-from-log-and-visualize-them/m-p/594236#M206820</link>
      <description>&lt;P&gt;Try it like this&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex max_match=0 "(?&amp;lt;namevalue&amp;gt;\w[\w\s\-]+=\s[^,\n\}]+)"&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 19 Apr 2022 10:48:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pairs-from-log-and-visualize-them/m-p/594236#M206820</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-04-19T10:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract key-value pairs from log and visualize them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pairs-from-log-and-visualize-them/m-p/594238#M206821</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="arnavkumarsaxen_0-1650366380136.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/19129iADD98B65D4FB12C5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="arnavkumarsaxen_0-1650366380136.png" alt="arnavkumarsaxen_0-1650366380136.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Values still coming in this way&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 11:06:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pairs-from-log-and-visualize-them/m-p/594238#M206821</guid>
      <dc:creator>arnavkumarsaxen</dc:creator>
      <dc:date>2022-04-19T11:06:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract key-value pairs from log and visualize them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pairs-from-log-and-visualize-them/m-p/594242#M206822</link>
      <description>&lt;P&gt;Assuming you don't want anything after (and including) a backslash, try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex max_match=0 "(?&amp;lt;namevalue&amp;gt;\w[\w\s\-]+=\s[^,\\\\]+)(?=\\\\)?"&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 19 Apr 2022 11:35:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pairs-from-log-and-visualize-them/m-p/594242#M206822</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-04-19T11:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract key-value pairs from log and visualize them</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pairs-from-log-and-visualize-them/m-p/594249#M206826</link>
      <description>&lt;P&gt;Thanks a lot. It worked.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 12:10:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-key-value-pairs-from-log-and-visualize-them/m-p/594249#M206826</guid>
      <dc:creator>arnavkumarsaxen</dc:creator>
      <dc:date>2022-04-19T12:10:53Z</dc:date>
    </item>
  </channel>
</rss>

