<?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 process varying number of Key=Value pairs in a log? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-process-varying-number-of-Key-Value-pairs-in-a-log/m-p/21403#M785</link>
    <description>&lt;P&gt;Similar issue to Sonny.&lt;BR /&gt;
I have a a variable indeterminate number of keys (up to 1 million) some of which are in each log message and each  key has an associated count.  The "keys" are numeric given the large number of potential keys.  There is standard fixed format prefix information that is handled correctly.&lt;/P&gt;

&lt;P&gt;L-rec1   std-stuff[987=31,13=2, 70201=11]&lt;BR /&gt;
Lrec2    std-stuff[91453=87,861=101,31297=76,78=1001,987=11,123=678,135=246,971=677]&lt;/P&gt;

&lt;P&gt;Search picks up the key value pairs as "field1" to "fieldn"  where there are about 900 max Kv pairs.&lt;BR /&gt;
I want to work with the keys (group, scatter).&lt;BR /&gt;
Any suggestions would be appreciated&lt;BR /&gt;
:-)&lt;/P&gt;</description>
    <pubDate>Tue, 28 Mar 2017 19:06:50 GMT</pubDate>
    <dc:creator>plynch52</dc:creator>
    <dc:date>2017-03-28T19:06:50Z</dc:date>
    <item>
      <title>How to process varying number of Key=Value pairs in a log?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-process-varying-number-of-Key-Value-pairs-in-a-log/m-p/21400#M782</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Scenario&lt;/STRONG&gt;:  Event lines in the log come with varying number of key=value pairs, where nothing is predetermined:  Neither the names of the keys, nor the set of values, nor the number of such key=value pairs found in the log.&lt;/P&gt;

&lt;P&gt;The &lt;STRONG&gt;question&lt;/STRONG&gt; is: How to create &lt;STRONG&gt;generic&lt;/STRONG&gt;, &lt;STRONG&gt;dynamic&lt;/STRONG&gt; processing search/eval construct, that can gather and process such values from the eventdata? (i.e. only “=” and “,” delimiters are standardized).&lt;/P&gt;

&lt;P&gt;Giving below is an example that would show the situation.  Any help will be deeply appreciated!&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Specification&lt;/STRONG&gt;:&lt;BR /&gt;&lt;BR /&gt;
                &amp;lt;&amp;lt; some std. access_combined fields here&amp;gt;&amp;gt; followed by: indefinite, comma-separated K=V pairs&lt;/P&gt;

&lt;P&gt;where K=V format is: methodName=DurationInteger&lt;/P&gt;

&lt;P&gt;Sample Log data example:&lt;/P&gt;

&lt;P&gt;Event1:   … method1=100,method2=250,method3=150&lt;/P&gt;

&lt;P&gt;Event2:   … method1=125,method2=275,method3=325,methodSome=300,method5=50&lt;/P&gt;

&lt;P&gt;Event3:   … method1=15,method2=35,methodOther=100,nextMethod4=500&lt;/P&gt;

&lt;P&gt;Event4:   … method1=125,method2Last=275&lt;/P&gt;

&lt;P&gt;Event5:   … methodSolo=400&lt;/P&gt;

&lt;P&gt;Regex/Search/Eval expression needed to be built that can dynamically gather and sum-up all the integer numbers representing the duration values of all the above method-names &lt;STRONG&gt;without knowing the number of such key=value pairs&lt;/STRONG&gt; in advance in any eventdata line (i.e. the answer should be = &lt;STRONG&gt;3025&lt;/STRONG&gt; for the entire transaction that constitute the above five events).  Any insights would be greatly appreciated. Happy Easter!&lt;/P&gt;</description>
      <pubDate>Sat, 07 Apr 2012 00:12:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-process-varying-number-of-Key-Value-pairs-in-a-log/m-p/21400#M782</guid>
      <dc:creator>SonnyB</dc:creator>
      <dc:date>2012-04-07T00:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to process varying number of Key=Value pairs in a log?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-process-varying-number-of-Key-Value-pairs-in-a-log/m-p/21401#M783</link>
      <description>&lt;P&gt;Splunk will auto extract the key=value pairs for you at Search time.&lt;/P&gt;

&lt;P&gt;As for adding up the method times, the following example seemed to work in 4.3. It's a bit hacky and relys on the method times being the only numeric fields extracted at Search time. But as you say, nothing is predetermined, so I can't declare a pattern in the addTotals command to detect the method fields ie: "method*"&lt;/P&gt;

&lt;P&gt;So try this :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | fields - linecount | addtotals fieldname=foo | stats sum(foo)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 07 Apr 2012 06:50:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-process-varying-number-of-Key-Value-pairs-in-a-log/m-p/21401#M783</guid>
      <dc:creator>Damien_Dallimor</dc:creator>
      <dc:date>2012-04-07T06:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to process varying number of Key=Value pairs in a log?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-process-varying-number-of-Key-Value-pairs-in-a-log/m-p/21402#M784</link>
      <description>&lt;P&gt;Yes, this is one of the main benefits of Splunk over a structured logging solution. Basically, you can just put whatever in there, and it will extract them just fine. There are some tricks or additional config if you need to worry about escaping odd characters, or have multi-line values, but there are some answers on this site that address this if you need.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Apr 2012 21:12:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-process-varying-number-of-Key-Value-pairs-in-a-log/m-p/21402#M784</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2012-04-07T21:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to process varying number of Key=Value pairs in a log?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-process-varying-number-of-Key-Value-pairs-in-a-log/m-p/21403#M785</link>
      <description>&lt;P&gt;Similar issue to Sonny.&lt;BR /&gt;
I have a a variable indeterminate number of keys (up to 1 million) some of which are in each log message and each  key has an associated count.  The "keys" are numeric given the large number of potential keys.  There is standard fixed format prefix information that is handled correctly.&lt;/P&gt;

&lt;P&gt;L-rec1   std-stuff[987=31,13=2, 70201=11]&lt;BR /&gt;
Lrec2    std-stuff[91453=87,861=101,31297=76,78=1001,987=11,123=678,135=246,971=677]&lt;/P&gt;

&lt;P&gt;Search picks up the key value pairs as "field1" to "fieldn"  where there are about 900 max Kv pairs.&lt;BR /&gt;
I want to work with the keys (group, scatter).&lt;BR /&gt;
Any suggestions would be appreciated&lt;BR /&gt;
:-)&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 19:06:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-process-varying-number-of-Key-Value-pairs-in-a-log/m-p/21403#M785</guid>
      <dc:creator>plynch52</dc:creator>
      <dc:date>2017-03-28T19:06:50Z</dc:date>
    </item>
  </channel>
</rss>

