<?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: Copy the value of a metadata filed to a new field at Index time in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Copy-the-value-of-a-metadata-filed-to-a-new-field-at-Index-time/m-p/301607#M56996</link>
    <description>&lt;P&gt;Good job on updating us!  Now close it all off by clicking Accept on your answer.&lt;/P&gt;</description>
    <pubDate>Wed, 09 Aug 2017 11:19:53 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2017-08-09T11:19:53Z</dc:date>
    <item>
      <title>Copy the value of a metadata filed to a new field at Index time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Copy-the-value-of-a-metadata-filed-to-a-new-field-at-Index-time/m-p/301603#M56992</link>
      <description>&lt;P&gt;I have some network devices sending logs to a syslog server that has a UF installed. The 'host' field is populated with the name of the UF host.&lt;BR /&gt;
We want the 'host' to be overwritten with the name of the hosts that are generating the logs initially (easy) however we also want to create an additional field ('forwarder') which will keep the name of the UF host. &lt;/P&gt;

&lt;P&gt;I believe the best way of doing this would be to use transforms to first copy the value of the 'host' field to the new 'forwarder' field however It doesn't seem to be working with the following stanza&lt;/P&gt;

&lt;P&gt;props.conf&lt;BR /&gt;
[source::/var/log/messages]&lt;BR /&gt;
TRANSFORMS-t1=copy_host_name&lt;/P&gt;

&lt;P&gt;transforms.conf&lt;BR /&gt;
[copy_host_name]&lt;BR /&gt;
SOURCE_KEY = MetaData::host&lt;BR /&gt;
REGEX = (.*)&lt;BR /&gt;
FORMAT = forwarder::$1&lt;BR /&gt;
WRITE_META = true&lt;/P&gt;

&lt;P&gt;fields.conf  (on the search head)&lt;BR /&gt;
[forwarder]&lt;BR /&gt;
INDEXED=true&lt;/P&gt;

&lt;P&gt;any suggestions?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 14:49:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Copy-the-value-of-a-metadata-filed-to-a-new-field-at-Index-time/m-p/301603#M56992</guid>
      <dc:creator>MedralaG</dc:creator>
      <dc:date>2020-09-29T14:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Copy the value of a metadata filed to a new field at Index time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Copy-the-value-of-a-metadata-filed-to-a-new-field-at-Index-time/m-p/301604#M56993</link>
      <description>&lt;P&gt;Hi MedralaG,&lt;BR /&gt;
I'd use a different approach:&lt;BR /&gt;
I'd replace host with the correct host value (as you're doing) and I'd create a lookup with two columns:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;host of appliance sending logs to a UF,&lt;/LI&gt;
&lt;LI&gt;UF name.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;In this way, you always have both the information, host and related UF, in an easier way.&lt;BR /&gt;
Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jul 2017 06:46:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Copy-the-value-of-a-metadata-filed-to-a-new-field-at-Index-time/m-p/301604#M56993</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-07-08T06:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Copy the value of a metadata filed to a new field at Index time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Copy-the-value-of-a-metadata-filed-to-a-new-field-at-Index-time/m-p/301605#M56994</link>
      <description>&lt;P&gt;First, do your syslog this way:&lt;BR /&gt;
&lt;A href="http://www.georgestarcher.com/splunk-success-with-syslog/"&gt;http://www.georgestarcher.com/splunk-success-with-syslog/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;But do it with 1 wrinkle: make sure that your syslog host name is also in the file path.&lt;BR /&gt;
Then you can get at it any time that you like with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SOURCE_KEY = MetaData::source
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=source "(?:[^\/]+\/){4}(?&amp;lt;syslog_host&amp;gt;[^\/]+)" 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 08 Jul 2017 14:39:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Copy-the-value-of-a-metadata-filed-to-a-new-field-at-Index-time/m-p/301605#M56994</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-07-08T14:39:52Z</dc:date>
    </item>
    <item>
      <title>Re: Copy the value of a metadata filed to a new field at Index time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Copy-the-value-of-a-metadata-filed-to-a-new-field-at-Index-time/m-p/301606#M56995</link>
      <description>&lt;P&gt;Just for the record, I managed to find the problem that was causing my stanza in the transforms.conf not to work.&lt;BR /&gt;
1. I had to remove the additional &lt;CODE&gt;:&lt;/CODE&gt; in the &lt;CODE&gt;SOURCEKEY&lt;/CODE&gt; stanza. This will allow me to pull the data from the &lt;CODE&gt;HOST&lt;/CODE&gt; metadata field into the transforms.&lt;BR /&gt;
2. The value pulled from the &lt;CODE&gt;SOURCEKEY = MetaData:host&lt;/CODE&gt; will appear in the following format:  &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host::*hostname*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This means that I have to adjust the REGEX to exclude the &lt;CODE&gt;host::&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[source::/var/log/messages]
TRANSFORMS-t1=copy_host_name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[copy_host_name]
SOURCE_KEY = MetaData:host
REGEX = host::(.*)
FORMAT = forwarder::$1
WRITE_META = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;fields.conf (on the search head)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[forwarder]
INDEXED=true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;With these corrections made I am successfully able to copy the value of the &lt;CODE&gt;HOST&lt;/CODE&gt; field to a newly created field (at index time) and then I'm free overwrite the original &lt;CODE&gt;host&lt;/CODE&gt; field.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 10:58:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Copy-the-value-of-a-metadata-filed-to-a-new-field-at-Index-time/m-p/301606#M56995</guid>
      <dc:creator>MedralaG</dc:creator>
      <dc:date>2017-08-09T10:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Copy the value of a metadata filed to a new field at Index time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Copy-the-value-of-a-metadata-filed-to-a-new-field-at-Index-time/m-p/301607#M56996</link>
      <description>&lt;P&gt;Good job on updating us!  Now close it all off by clicking Accept on your answer.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 11:19:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Copy-the-value-of-a-metadata-filed-to-a-new-field-at-Index-time/m-p/301607#M56996</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-08-09T11:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: Copy the value of a metadata filed to a new field at Index time</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Copy-the-value-of-a-metadata-filed-to-a-new-field-at-Index-time/m-p/301608#M56997</link>
      <description>&lt;P&gt;Done, thank you. &lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 11:37:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Copy-the-value-of-a-metadata-filed-to-a-new-field-at-Index-time/m-p/301608#M56997</guid>
      <dc:creator>MedralaG</dc:creator>
      <dc:date>2017-08-09T11:37:05Z</dc:date>
    </item>
  </channel>
</rss>

