<?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: Setting event time and host metadata from key/value pairs in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Setting-event-time-and-host-metadata-from-key-value-pairs/m-p/304997#M57504</link>
    <description>&lt;P&gt;Do this at index time (aka on forwarders &amp;amp; indexers)&lt;/P&gt;

&lt;P&gt;Props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [yourSourcetype]
TRANSFORMS-datetime=datetimeTransform
TRANSFORMS-hostname=hostnameTransform
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[datetimeTransform]
SOURCE_KEY = _raw
REGEX = some regex with a capture group that captures the datetime stamp
DEST_KEY = _time

[hostnameTransform]
SOURCE_KEY = _raw
REGEX = some regex with a capture group that captures host
DEST_KEY = MetaData:Host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See transforms.conf for a list of DEST_KEYs&lt;/P&gt;</description>
    <pubDate>Wed, 15 Feb 2017 18:06:11 GMT</pubDate>
    <dc:creator>jkat54</dc:creator>
    <dc:date>2017-02-15T18:06:11Z</dc:date>
    <item>
      <title>Setting event time and host metadata from key/value pairs</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Setting-event-time-and-host-metadata-from-key-value-pairs/m-p/304996#M57503</link>
      <description>&lt;P&gt;I have this nice JSON event that has all the information I need in it, most namely timestamp and hostname of transaction. How do I rewrite the event to update metadata host and time? This cannot be that hard, the docs show REGEX but I would be able to just use fields.?!?!?! &lt;/P&gt;

&lt;P&gt;Any help is much appreciated!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2017 17:45:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Setting-event-time-and-host-metadata-from-key-value-pairs/m-p/304996#M57503</guid>
      <dc:creator>brent_weaver</dc:creator>
      <dc:date>2017-02-15T17:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: Setting event time and host metadata from key/value pairs</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Setting-event-time-and-host-metadata-from-key-value-pairs/m-p/304997#M57504</link>
      <description>&lt;P&gt;Do this at index time (aka on forwarders &amp;amp; indexers)&lt;/P&gt;

&lt;P&gt;Props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [yourSourcetype]
TRANSFORMS-datetime=datetimeTransform
TRANSFORMS-hostname=hostnameTransform
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[datetimeTransform]
SOURCE_KEY = _raw
REGEX = some regex with a capture group that captures the datetime stamp
DEST_KEY = _time

[hostnameTransform]
SOURCE_KEY = _raw
REGEX = some regex with a capture group that captures host
DEST_KEY = MetaData:Host
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;See transforms.conf for a list of DEST_KEYs&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2017 18:06:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Setting-event-time-and-host-metadata-from-key-value-pairs/m-p/304997#M57504</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-02-15T18:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: Setting event time and host metadata from key/value pairs</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Setting-event-time-and-host-metadata-from-key-value-pairs/m-p/304998#M57505</link>
      <description>&lt;P&gt;Thanks for the response, do I have to use a REGEX to get the value, can't I just use the key from the key value pair?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2017 18:22:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Setting-event-time-and-host-metadata-from-key-value-pairs/m-p/304998#M57505</guid>
      <dc:creator>brent_weaver</dc:creator>
      <dc:date>2017-02-15T18:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: Setting event time and host metadata from key/value pairs</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Setting-event-time-and-host-metadata-from-key-value-pairs/m-p/304999#M57506</link>
      <description>&lt;P&gt;I suppose you could and if you absolutely have to have regex= to work... Just do (.*) as your regex.&lt;/P&gt;</description>
      <pubDate>Wed, 15 Feb 2017 19:31:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Setting-event-time-and-host-metadata-from-key-value-pairs/m-p/304999#M57506</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2017-02-15T19:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: Setting event time and host metadata from key/value pairs</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Setting-event-time-and-host-metadata-from-key-value-pairs/m-p/305000#M57507</link>
      <description>&lt;P&gt;Thank for the response. I guesss the question is, do I absolutely need to have REGEX? What I am contending with is a format where I have a time stand followed buy host IP address, the a fully intact JSON string. So In my JSON string I have the true time of the event as a field called timestamp. &lt;/P&gt;

&lt;P&gt;My props is as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[bv]
KV_MODE = json
INDEXTED_EXTRACTIONS = json
TRANSFORMS-extract = json_extraction
FIELDALIAS-conn_id = protocol.session_id AS conn_id
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[json_extraction]
SOURCE_KEY = _raw
DEST_KEY = _raw
REGEX = ^([^{]+)({.+})$
FORMAT = $2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As you see I carve out the first two elements and only keep the JSON string. So this now leaves me with all the metadata I would need to. So how do I use these kv pairs to set this?&lt;/P&gt;</description>
      <pubDate>Sun, 19 Feb 2017 16:07:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Setting-event-time-and-host-metadata-from-key-value-pairs/m-p/305000#M57507</guid>
      <dc:creator>brent_weaver</dc:creator>
      <dc:date>2017-02-19T16:07:03Z</dc:date>
    </item>
  </channel>
</rss>

