<?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 Duplicate Host Field from JSON Event in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Duplicate-Host-Field-from-JSON-Event/m-p/458750#M129533</link>
    <description>&lt;P&gt;Hey there,&lt;/P&gt;

&lt;P&gt;we are pumping millions of Zabbix events in to our splunk environment over a Heavy Forwarder. The events are JSON string like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"host":"myHostname","groups":["OS_RHEL","OS_RHEL_ES"],"applications":["FS RHELBASIC","Filesystems"],"itemid":1234,"name":"/var/log - used space (total)","clock":1562748008,"ns":583690877,"value":194605056}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the props for this sourcetype looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;props.conf
TIME_PREFIX=\"clock\"\:
CHARSET=UTF-8
INDEXED_EXTRACTIONS=json
SHOULD_LINEMERGE=false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;At first my problem was that the host field was filled with the hostname of the Heavy Forwarder. For easier use for our users, i want the host from the JSON event in my splunk "host" field. I tried to do that with following transforms:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[set_hostname_zabbix]
REGEX = "host":"(?P&amp;lt;host&amp;gt;[^"]+)
FORMAT = host::$1
DEST_KEY = MetaData:Host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This kind of worked, but now my problem is that i got two host fields both filled with the same data.&lt;BR /&gt;
Any ideas how I can fix this, so I just get one host field filled with the hostname from the JSON event?&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;Max&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jul 2019 08:52:37 GMT</pubDate>
    <dc:creator>max_weber</dc:creator>
    <dc:date>2019-07-10T08:52:37Z</dc:date>
    <item>
      <title>Duplicate Host Field from JSON Event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Duplicate-Host-Field-from-JSON-Event/m-p/458750#M129533</link>
      <description>&lt;P&gt;Hey there,&lt;/P&gt;

&lt;P&gt;we are pumping millions of Zabbix events in to our splunk environment over a Heavy Forwarder. The events are JSON string like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"host":"myHostname","groups":["OS_RHEL","OS_RHEL_ES"],"applications":["FS RHELBASIC","Filesystems"],"itemid":1234,"name":"/var/log - used space (total)","clock":1562748008,"ns":583690877,"value":194605056}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the props for this sourcetype looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;props.conf
TIME_PREFIX=\"clock\"\:
CHARSET=UTF-8
INDEXED_EXTRACTIONS=json
SHOULD_LINEMERGE=false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;At first my problem was that the host field was filled with the hostname of the Heavy Forwarder. For easier use for our users, i want the host from the JSON event in my splunk "host" field. I tried to do that with following transforms:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[set_hostname_zabbix]
REGEX = "host":"(?P&amp;lt;host&amp;gt;[^"]+)
FORMAT = host::$1
DEST_KEY = MetaData:Host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This kind of worked, but now my problem is that i got two host fields both filled with the same data.&lt;BR /&gt;
Any ideas how I can fix this, so I just get one host field filled with the hostname from the JSON event?&lt;/P&gt;

&lt;P&gt;Regards,&lt;/P&gt;

&lt;P&gt;Max&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 08:52:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Duplicate-Host-Field-from-JSON-Event/m-p/458750#M129533</guid>
      <dc:creator>max_weber</dc:creator>
      <dc:date>2019-07-10T08:52:37Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Host Field from JSON Event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Duplicate-Host-Field-from-JSON-Event/m-p/458751#M129534</link>
      <description>&lt;P&gt;You have 2 options.  You could set &lt;CODE&gt;KV_MODE = none&lt;/CODE&gt; and because you are using &lt;CODE&gt;indexed_extractions&lt;/CODE&gt; anyway, this should work fine.  You could also set a calculated field like this: &lt;CODE&gt;eval-host=mvdedup(host)&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 18:34:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Duplicate-Host-Field-from-JSON-Event/m-p/458751#M129534</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-07-10T18:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate Host Field from JSON Event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Duplicate-Host-Field-from-JSON-Event/m-p/458752#M129535</link>
      <description>&lt;P&gt;thanks for you advice. i have to try this.&lt;/P&gt;

&lt;P&gt;but I think the first method won't help, cause the "host" field is a field which is always extracted not depending on the KV_MODE setting.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 09:40:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Duplicate-Host-Field-from-JSON-Event/m-p/458752#M129535</guid>
      <dc:creator>max_weber</dc:creator>
      <dc:date>2019-07-19T09:40:22Z</dc:date>
    </item>
  </channel>
</rss>

