<?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 do you select a key value based on key name? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-select-a-key-value-based-on-key-name/m-p/416545#M73579</link>
    <description>&lt;P&gt;You can do this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;YOUR_SEARCH | rex "\"variableName\"\s*:\s*\"age\"\s*,\s*\"[^\"]+\"\s*:\s*\"(?&amp;lt;age&amp;gt;[^"]*)\""&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;to get the age. Or you can use this sort of field extraction to extract all values properly:&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_sourcetype]
REPORT-my_json_pairs = my_json_pairs
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_json_pairs]
REGEX = \"variableName\"\s*:\s*\"(?&amp;lt;_KEY_1&amp;gt;[^"]*)\"\s*,\s*\"[^\"]+\"\s*:\s*\"(?&amp;lt;_VAL_1&amp;gt;[^"]*)\"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;All the best&lt;/P&gt;</description>
    <pubDate>Wed, 27 Feb 2019 20:51:34 GMT</pubDate>
    <dc:creator>chrisyounger</dc:creator>
    <dc:date>2019-02-27T20:51:34Z</dc:date>
    <item>
      <title>How do you select a key value based on key name?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-select-a-key-value-based-on-key-name/m-p/416544#M73578</link>
      <description>&lt;H2&gt;I have a log that looks similar to this:&lt;/H2&gt;

&lt;P&gt;`{&lt;BR /&gt;
  "name": "Joe",&lt;BR /&gt;
  "variables":[&lt;BR /&gt;
    {&lt;BR /&gt;
      "variableName":"age",&lt;BR /&gt;
      "variableValue":"30"&lt;BR /&gt;
    },&lt;BR /&gt;
    {&lt;BR /&gt;
      "variableName":"gender",&lt;BR /&gt;
      "variableValue":"male"&lt;BR /&gt;
    },&lt;BR /&gt;
    {&lt;BR /&gt;
      "variableName":"state",&lt;BR /&gt;
      "variableValue":"WA"&lt;BR /&gt;
    }]&lt;/P&gt;

&lt;H2&gt;}`&lt;/H2&gt;

&lt;P&gt;How do I go about selecting for example the gender or age in this log?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 19:27:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-select-a-key-value-based-on-key-name/m-p/416544#M73578</guid>
      <dc:creator>jmount15</dc:creator>
      <dc:date>2019-02-27T19:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do you select a key value based on key name?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-select-a-key-value-based-on-key-name/m-p/416545#M73579</link>
      <description>&lt;P&gt;You can do this:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;YOUR_SEARCH | rex "\"variableName\"\s*:\s*\"age\"\s*,\s*\"[^\"]+\"\s*:\s*\"(?&amp;lt;age&amp;gt;[^"]*)\""&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;to get the age. Or you can use this sort of field extraction to extract all values properly:&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_sourcetype]
REPORT-my_json_pairs = my_json_pairs
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[my_json_pairs]
REGEX = \"variableName\"\s*:\s*\"(?&amp;lt;_KEY_1&amp;gt;[^"]*)\"\s*,\s*\"[^\"]+\"\s*:\s*\"(?&amp;lt;_VAL_1&amp;gt;[^"]*)\"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;All the best&lt;/P&gt;</description>
      <pubDate>Wed, 27 Feb 2019 20:51:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-select-a-key-value-based-on-key-name/m-p/416545#M73579</guid>
      <dc:creator>chrisyounger</dc:creator>
      <dc:date>2019-02-27T20:51:34Z</dc:date>
    </item>
  </channel>
</rss>

