<?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 Nested KV Pairs w/ Multiple Values per Key in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Nested-KV-Pairs-w-Multiple-Values-per-Key/m-p/64304#M15903</link>
    <description>&lt;P&gt;I'm trying to parse some input where the kv pairs are nested, but I'm also trying to cheat a little bit. Maybe.&lt;/P&gt;

&lt;P&gt;With a data source of:&lt;/P&gt;

&lt;P&gt;rec=buddies buddy=Jerry animal=cat(aloof, quadruped, canhaz, Frank) dog(doglike, quadruped, derp, Carol), bird(istheword, winged, flippable, MisterSquawk)&lt;/P&gt;

&lt;P&gt;rec=buddies buddy=Augustine animal=horse(toothy, speaks, quadruped, Biscuits) dog(ladylike, tri-ped, rabid, Bubbles)&lt;/P&gt;

&lt;P&gt;Can I have Splunk ingest both of these as single records but also return the appropriate record for the following searches:&lt;/P&gt;

&lt;P&gt;animal=horse OR animal=bird&lt;/P&gt;

&lt;P&gt;?&lt;/P&gt;

&lt;P&gt;Next, can I have splunk create a kv pair according to each "attribute" of each animal from this input to allow for searches like:&lt;/P&gt;

&lt;P&gt;animal_funct=aloof (returns this record, and "animal_funct" is the field I'd like Splunk to 'discover' and index)&lt;/P&gt;

&lt;P&gt;cat_funct=aloof
(returns this record, and "cat_funct" is the field I'd like splunk to discover and index)&lt;/P&gt;

&lt;P&gt;and better yet, have a search that asks for 'dog_funct=doglike' and will return buddy=Jerry?&lt;/P&gt;

&lt;P&gt;It seems like a regex-heavy solution is in my future, but the more Splunky angle is how can I make Splunk heed my nested input bidding?&lt;/P&gt;

&lt;P&gt;Finally, with animal being defined 5 times in these two records, how can I make splunk answer a question of "rec=buddy | stats count(animal)" with 5 instead of 2 which it seems to do currently with repeated keys in a single message?&lt;/P&gt;

&lt;P&gt;Apologies for this question available upon request.  I'm not even sure which terminology I should be using for parsing kv pairs from a list of attributes.&lt;/P&gt;</description>
    <pubDate>Tue, 22 Mar 2011 05:07:02 GMT</pubDate>
    <dc:creator>blurblebot</dc:creator>
    <dc:date>2011-03-22T05:07:02Z</dc:date>
    <item>
      <title>Nested KV Pairs w/ Multiple Values per Key</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nested-KV-Pairs-w-Multiple-Values-per-Key/m-p/64304#M15903</link>
      <description>&lt;P&gt;I'm trying to parse some input where the kv pairs are nested, but I'm also trying to cheat a little bit. Maybe.&lt;/P&gt;

&lt;P&gt;With a data source of:&lt;/P&gt;

&lt;P&gt;rec=buddies buddy=Jerry animal=cat(aloof, quadruped, canhaz, Frank) dog(doglike, quadruped, derp, Carol), bird(istheword, winged, flippable, MisterSquawk)&lt;/P&gt;

&lt;P&gt;rec=buddies buddy=Augustine animal=horse(toothy, speaks, quadruped, Biscuits) dog(ladylike, tri-ped, rabid, Bubbles)&lt;/P&gt;

&lt;P&gt;Can I have Splunk ingest both of these as single records but also return the appropriate record for the following searches:&lt;/P&gt;

&lt;P&gt;animal=horse OR animal=bird&lt;/P&gt;

&lt;P&gt;?&lt;/P&gt;

&lt;P&gt;Next, can I have splunk create a kv pair according to each "attribute" of each animal from this input to allow for searches like:&lt;/P&gt;

&lt;P&gt;animal_funct=aloof (returns this record, and "animal_funct" is the field I'd like Splunk to 'discover' and index)&lt;/P&gt;

&lt;P&gt;cat_funct=aloof
(returns this record, and "cat_funct" is the field I'd like splunk to discover and index)&lt;/P&gt;

&lt;P&gt;and better yet, have a search that asks for 'dog_funct=doglike' and will return buddy=Jerry?&lt;/P&gt;

&lt;P&gt;It seems like a regex-heavy solution is in my future, but the more Splunky angle is how can I make Splunk heed my nested input bidding?&lt;/P&gt;

&lt;P&gt;Finally, with animal being defined 5 times in these two records, how can I make splunk answer a question of "rec=buddy | stats count(animal)" with 5 instead of 2 which it seems to do currently with repeated keys in a single message?&lt;/P&gt;

&lt;P&gt;Apologies for this question available upon request.  I'm not even sure which terminology I should be using for parsing kv pairs from a list of attributes.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2011 05:07:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nested-KV-Pairs-w-Multiple-Values-per-Key/m-p/64304#M15903</guid>
      <dc:creator>blurblebot</dc:creator>
      <dc:date>2011-03-22T05:07:02Z</dc:date>
    </item>
    <item>
      <title>Re: Nested KV Pairs w/ Multiple Values per Key</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Nested-KV-Pairs-w-Multiple-Values-per-Key/m-p/64305#M15904</link>
      <description>&lt;P&gt;I would say that maybe a regex is not the right way to go here, at least not 100%. I would like at creating search macros instead, that would first filter out events that contained the right terms, then validated them against a regex, rather than trying to extract all the terms from the regex. If you need to report (rather than search) over the data, then I would suggest a custom search command to process the data rather than a pure regex field extraction solution.&lt;/P&gt;

&lt;P&gt;You could do things differently if you were able to write the data out differently, but I don't know if you have any control over that.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Mar 2011 07:54:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Nested-KV-Pairs-w-Multiple-Values-per-Key/m-p/64305#M15904</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2011-03-22T07:54:06Z</dc:date>
    </item>
  </channel>
</rss>

