<?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 configure Splunk to extract key value pairs with JSON log data from Http Event Collector? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-extract-key-value-pairs-with-JSON-log/m-p/372720#M67607</link>
    <description>&lt;P&gt;Given your concern about the performance of index-time extractions, search-time working is good, right?&lt;/P&gt;</description>
    <pubDate>Mon, 09 Oct 2017 18:42:02 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2017-10-09T18:42:02Z</dc:date>
    <item>
      <title>How to configure Splunk to extract key value pairs with JSON log data from Http Event Collector?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-extract-key-value-pairs-with-JSON-log/m-p/372715#M67602</link>
      <description>&lt;P&gt;We have started using the Http Event Collector (HEC) for logging directly from our Java apps. HEC takes data in JSON format but we have a lot of legacy code that logs key/value pairs and some searches/dashboards that utilize these. Data logged to HEC is by default indexed as the _json sourcetype and I have tried to configure this with KV_MODE=auto (for key/value) and json (for json-format) but none of these seem to trigger Splunk to index key/values. Example log statement: &lt;/P&gt;

&lt;P&gt;logger.info("corrId=11-1111-566 aa=88");&lt;/P&gt;

&lt;P&gt;However, I have not been able to search on the keys, e.g. &lt;EM&gt;search aa=88&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;The event looks like this:&lt;BR /&gt;
&lt;IMG src="https://community.splunk.com/storage/temp/217736-screenshot-2017-10-03-095137.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;Raw format: {"severity":"INFO","logger":"splunk.logger","thread":"main","message":"corrId=11-1111-566 aa=88"}&lt;/P&gt;

&lt;P&gt;Any ideas?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:04:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-extract-key-value-pairs-with-JSON-log/m-p/372715#M67602</guid>
      <dc:creator>ekst_andwii</dc:creator>
      <dc:date>2020-09-29T16:04:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure Splunk to extract key value pairs with JSON log data from Http Event Collector?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-extract-key-value-pairs-with-JSON-log/m-p/372716#M67603</link>
      <description>&lt;P&gt;Consider using transforms.&lt;/P&gt;

&lt;P&gt;Put this is your props.conf stanza&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;TRANSFORMS-messageFields = messageFields
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Then create this stanza in your transforms.conf file.  It should create a field for each word on the left of each '=' in the event.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[messageFields]
REGEX = ([a-z]+)=([\w\-]+)
FORMAT = $1::$2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Oct 2017 13:15:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-extract-key-value-pairs-with-JSON-log/m-p/372716#M67603</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-10-03T13:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure Splunk to extract key value pairs with JSON log data from Http Event Collector?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-extract-key-value-pairs-with-JSON-log/m-p/372717#M67604</link>
      <description>&lt;P&gt;Thanks for the reply @richgalloway, however, I can not get this to work. First of all, I think there's a typo, should it not be TRANSFORMS-messageFields? I've added this to props.conf and transforms.conf but Splunk still does not index fields in the message element.&lt;/P&gt;

&lt;P&gt;Also, I'm a bit skeptical to adding index-time extractions in the first place as this could have a big performance impact.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Oct 2017 14:04:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-extract-key-value-pairs-with-JSON-log/m-p/372717#M67604</guid>
      <dc:creator>ekst_andwii</dc:creator>
      <dc:date>2017-10-03T14:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure Splunk to extract key value pairs with JSON log data from Http Event Collector?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-extract-key-value-pairs-with-JSON-log/m-p/372718#M67605</link>
      <description>&lt;P&gt;Yes, it should be &lt;CODE&gt;TRANSFORMS&lt;/CODE&gt;.  I've corrected my answer.&lt;BR /&gt;
Once you change the config files you need to restart Splunk and then re-index the data as existing events will not be affected.&lt;BR /&gt;
To do the same thing at search time try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your base search&amp;gt; | rex field=message "corrId=(?&amp;lt;corrId&amp;gt;[^\s]+)\saa=(?&amp;lt;aa&amp;gt;[.*]?)" | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Oct 2017 16:27:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-extract-key-value-pairs-with-JSON-log/m-p/372718#M67605</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-10-03T16:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure Splunk to extract key value pairs with JSON log data from Http Event Collector?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-extract-key-value-pairs-with-JSON-log/m-p/372719#M67606</link>
      <description>&lt;P&gt;Still cannot get index-time extractions to work, search-time works. &lt;/P&gt;</description>
      <pubDate>Wed, 04 Oct 2017 10:42:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-extract-key-value-pairs-with-JSON-log/m-p/372719#M67606</guid>
      <dc:creator>ekst_andwii</dc:creator>
      <dc:date>2017-10-04T10:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure Splunk to extract key value pairs with JSON log data from Http Event Collector?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-extract-key-value-pairs-with-JSON-log/m-p/372720#M67607</link>
      <description>&lt;P&gt;Given your concern about the performance of index-time extractions, search-time working is good, right?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Oct 2017 18:42:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-extract-key-value-pairs-with-JSON-log/m-p/372720#M67607</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-10-09T18:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to configure Splunk to extract key value pairs with JSON log data from Http Event Collector?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-extract-key-value-pairs-with-JSON-log/m-p/372721#M67608</link>
      <description>&lt;P&gt;Yes, but we want this to happen automatically through KV_MODE in props.conf. That's what we had before, without having to use rex and naming each field at search time.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Oct 2017 09:17:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-configure-Splunk-to-extract-key-value-pairs-with-JSON-log/m-p/372721#M67608</guid>
      <dc:creator>ekst_andwii</dc:creator>
      <dc:date>2017-10-16T09:17:09Z</dc:date>
    </item>
  </channel>
</rss>

