<?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 detected_host, detected_timestamp, etc. with JSON file source in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/detected-host-detected-timestamp-etc-with-JSON-file-source/m-p/555677#M92016</link>
    <description>&lt;P&gt;If I upload a file containing JSON records or monitor such a file/scripted input, a field named &lt;EM&gt;host&lt;/EM&gt; becomes "detected_host", &lt;EM&gt;timestamp&lt;/EM&gt; becomes "detected_timestamp", etc. &amp;nbsp;Is there some way to persuade indexer to accept these fields as &lt;U&gt;host&lt;/U&gt;, &lt;U&gt;_time&lt;/U&gt;, etc.?&lt;/P&gt;&lt;P&gt;I am looking at a number of such sources all with varying field names for these. &amp;nbsp;So, I hope by renaming/setting corresponding commonly used fields I could just use the default _json sourcetype without resorting to search time tricks.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Jun 2021 16:41:52 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2021-06-14T16:41:52Z</dc:date>
    <item>
      <title>detected_host, detected_timestamp, etc. with JSON file source</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/detected-host-detected-timestamp-etc-with-JSON-file-source/m-p/555677#M92016</link>
      <description>&lt;P&gt;If I upload a file containing JSON records or monitor such a file/scripted input, a field named &lt;EM&gt;host&lt;/EM&gt; becomes "detected_host", &lt;EM&gt;timestamp&lt;/EM&gt; becomes "detected_timestamp", etc. &amp;nbsp;Is there some way to persuade indexer to accept these fields as &lt;U&gt;host&lt;/U&gt;, &lt;U&gt;_time&lt;/U&gt;, etc.?&lt;/P&gt;&lt;P&gt;I am looking at a number of such sources all with varying field names for these. &amp;nbsp;So, I hope by renaming/setting corresponding commonly used fields I could just use the default _json sourcetype without resorting to search time tricks.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jun 2021 16:41:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/detected-host-detected-timestamp-etc-with-JSON-file-source/m-p/555677#M92016</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2021-06-14T16:41:52Z</dc:date>
    </item>
    <item>
      <title>Re: detected_host, detected_timestamp, etc. with JSON file source</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/detected-host-detected-timestamp-etc-with-JSON-file-source/m-p/555704#M92028</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/33901"&gt;@yuanliu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Splunk doesn't prefix the fieldnames as detected* this could be some pre-existing settings at search/index time&amp;nbsp; modifying host, timestamp fields. Let's continue...to solution&lt;/P&gt;&lt;P&gt;To answers your query, for timestamp field use props.conf - TIME_PREFIX, TIME_FORMAT variables to consider as _time by Splunk. Should be deployed to HF/indexer.&lt;/P&gt;&lt;P&gt;host field in your json can be assigned to host default field using both props.conf, transforms.conf.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;##This is just example of host override, should be deployed to HF/indexer. #works for any input type UF/scripted input

#props.conf
[your_json_sourcetype/host::&amp;lt;hostname&amp;gt;/source::&amp;lt;your_source&amp;gt;]
TRANSFORMS-host = hostoverride

#Transforms.conf Override host: , REGEX should match your host in json payload
[hostoverride]
DEST_KEY = MetaData:Host
REGEX = \s(\w*)$
FORMAT = host::$1&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;---&lt;/P&gt;&lt;P&gt;An upvote would be appreciated if it helps!&lt;/P&gt;</description>
      <pubDate>Tue, 15 Jun 2021 00:55:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/detected-host-detected-timestamp-etc-with-JSON-file-source/m-p/555704#M92028</guid>
      <dc:creator>venkatasri</dc:creator>
      <dc:date>2021-06-15T00:55:18Z</dc:date>
    </item>
    <item>
      <title>Re: detected_host, detected_timestamp, etc. with JSON file source</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/detected-host-detected-timestamp-etc-with-JSON-file-source/m-p/556074#M92072</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;Splunk doesn't prefix the fieldnames as detected* this could be some pre-existing settings at search/index time&amp;nbsp; modifying host, timestamp fields. Let's continue...to solution&lt;/BLOCKQUOTE&gt;&lt;P&gt;Well, this is the behavior on a pretty clean install.&lt;/P&gt;&lt;P&gt;As you explained, if I want to set host/time/eventtype, etc., at index time for a JSON file, there is no escape from doing custom sourcetype, even if I change field names to host, _time, &amp;nbsp;etc. &amp;nbsp;Thanks,&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/163730"&gt;@venkatasri&lt;/a&gt;!&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jun 2021 01:40:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/detected-host-detected-timestamp-etc-with-JSON-file-source/m-p/556074#M92072</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2021-06-17T01:40:24Z</dc:date>
    </item>
  </channel>
</rss>

