<?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: Adding a field and changing source from Source in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Adding-a-field-and-changing-source-from-Source/m-p/147393#M30018</link>
    <description>&lt;P&gt;[monitor:///tmp/usr/local/sse/apache-ers/servers/aep.qa.abcd.org/logs/&lt;EM&gt;access.log&lt;/EM&gt;]&lt;BR /&gt;
blacklist = .(txt|gz)$&lt;BR /&gt;
sourcetype=apache&lt;/P&gt;

&lt;P&gt;Checked it like 20 times.&lt;/P&gt;</description>
    <pubDate>Fri, 02 May 2014 18:10:03 GMT</pubDate>
    <dc:creator>theouhuios</dc:creator>
    <dc:date>2014-05-02T18:10:03Z</dc:date>
    <item>
      <title>Adding a field and changing source from Source</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Adding-a-field-and-changing-source-from-Source/m-p/147386#M30011</link>
      <description>&lt;P&gt;hello&lt;/P&gt;

&lt;P&gt;I am trying to extract a field and change the value of source for apache logs. The source comes as &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/tmp/usr/local/sse/apache-ers/servers/aep.qa.abcd.org/logs/https_access.log.3242r4252"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;First, I am trying to extract &lt;CODE&gt;aep.qa.abcd.org&lt;/CODE&gt; as the field filename and change the source to &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  /tmp/usr/local/sse/apache-ers/servers/aep.qa.abcd.org/logs/https_access.log
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;props.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[apache]
TRANSFORMS-replace_values_from_source = replace_filename_from source , replace_source_from_source
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;transforms.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[replace_filename_from source]
SOURCE_KEY = MetaData:Source
REGEX = ^source::(?:/[^/]+){6}/(?P&amp;lt;filename&amp;gt;[a-z.]+)\/
FORMAT = filename::$1


[replace_source_from_source]
SOURCE_KEY = MetaData:Source
REGEX = ^source::^(\S+\.log)\.
FORMAT = source::$1
DEST_KEY = MetaData:Source
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It doesn't seem to work. I tested the regexes and they work fine with rex command. Any ideas?&lt;/P&gt;</description>
      <pubDate>Wed, 30 Apr 2014 14:41:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Adding-a-field-and-changing-source-from-Source/m-p/147386#M30011</guid>
      <dc:creator>theouhuios</dc:creator>
      <dc:date>2014-04-30T14:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a field and changing source from Source</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Adding-a-field-and-changing-source-from-Source/m-p/147387#M30012</link>
      <description>&lt;P&gt;I applied them on indexers and also applied the transforms on Search head. Still doesn't work&lt;/P&gt;</description>
      <pubDate>Wed, 30 Apr 2014 18:42:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Adding-a-field-and-changing-source-from-Source/m-p/147387#M30012</guid>
      <dc:creator>theouhuios</dc:creator>
      <dc:date>2014-04-30T18:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a field and changing source from Source</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Adding-a-field-and-changing-source-from-Source/m-p/147388#M30013</link>
      <description>&lt;P&gt;Removed transforms from index time and sent them only to searchtime for filename extraction. Even this doesn't work. Do I need to mention any DEST_KEY for it to work?&lt;/P&gt;</description>
      <pubDate>Thu, 01 May 2014 12:55:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Adding-a-field-and-changing-source-from-Source/m-p/147388#M30013</guid>
      <dc:creator>theouhuios</dc:creator>
      <dc:date>2014-05-01T12:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a field and changing source from Source</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Adding-a-field-and-changing-source-from-Source/m-p/147389#M30014</link>
      <description>&lt;P&gt;I'm not sure you need the source:: in the regex. We're not doing QUITE the same thing (not changing source, just sourcetype and index) but the "customer" field is an index-time field like what you're doing with filename. This is applied on our Splunk heavy forwarder that reads the files. If you're using a heavy forwarder to read the data, these should go there. If you're using a universal forwarder, or have the inputs.conf configured on the indexer, these should go on the indexer.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;props.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[source::/var/log/netsyslog/...]
TRANSFORMS-sourcetype = set_sourcetype_from_source_path
TRANSFORMS-customer = set_customer_from_source_path
TRANSFORMS-index = set_index_from_source_path
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;transforms.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[set_sourcetype_from_source_path]
SOURCE_KEY = MetaData:Source
DEST_KEY = MetaData:Sourcetype
REGEX = /var/log/netsyslog/[^/]+/([^/]+)/
FORMAT = sourcetype::$1

[set_customer_from_source_path]
SOURCE_KEY = MetaData:Source
WRITE_META = true
REGEX = /var/log/netsyslog/([^/]+)/
FORMAT = customer::$1

[set_index_from_source_path]
SOURCE_KEY = MetaData:Source
DEST_KEY = _MetaData:Index
REGEX = /var/log/netsyslog/([^/]+)/([^/]+)/
FORMAT = $2_$1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm not sure that you need the "source::" in the regex. In your first transform, you have a space in the stanza name, as well as escaping only one of the / in the regex (you don't need to escape any of them). In the second transform, you have "^source::^" which I don't think is what you want. You can give these a try, but I haven't tested them:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;props.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[apache]
TRANSFORMS-replace_values_from_source = replace_filename_from_source,replace_source_from_source
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;transforms.conf&lt;/STRONG&gt;&lt;BR /&gt;
    [replace_filename_from source]&lt;BR /&gt;
    SOURCE_KEY = MetaData:Source&lt;BR /&gt;
    WRITE_META = true&lt;BR /&gt;
    REGEX = (?:/[^/]+){6}/(?P&lt;FILENAME&gt;[a-z.]+)/&lt;BR /&gt;
    FORMAT = filename::$1&lt;/FILENAME&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[replace_source_from_source]
SOURCE_KEY = MetaData:Source
REGEX = ^(\S+\.log)\.[^.]+$
FORMAT = source::$1
DEST_KEY = MetaData:Source
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:31:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Adding-a-field-and-changing-source-from-Source/m-p/147389#M30014</guid>
      <dc:creator>mcmaster</dc:creator>
      <dc:date>2020-09-28T16:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a field and changing source from Source</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Adding-a-field-and-changing-source-from-Source/m-p/147390#M30015</link>
      <description>&lt;P&gt;Still doesn't work. I am not sure why but I think its not even applying them,which is kinda strange. I have done the similar extraction of yours for host,source and index from source for our rsyslog data sometime back and it worked on the HF.&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2014 13:02:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Adding-a-field-and-changing-source-from-Source/m-p/147390#M30015</guid>
      <dc:creator>theouhuios</dc:creator>
      <dc:date>2014-05-02T13:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a field and changing source from Source</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Adding-a-field-and-changing-source-from-Source/m-p/147391#M30016</link>
      <description>&lt;P&gt;Tried it one by one too. Doesn't work.Any ideas?&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2014 17:35:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Adding-a-field-and-changing-source-from-Source/m-p/147391#M30016</guid>
      <dc:creator>theouhuios</dc:creator>
      <dc:date>2014-05-02T17:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a field and changing source from Source</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Adding-a-field-and-changing-source-from-Source/m-p/147392#M30017</link>
      <description>&lt;P&gt;The logs are definitely being identified as sourcetype apache, right?&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2014 17:46:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Adding-a-field-and-changing-source-from-Source/m-p/147392#M30017</guid>
      <dc:creator>mcmaster</dc:creator>
      <dc:date>2014-05-02T17:46:39Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a field and changing source from Source</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Adding-a-field-and-changing-source-from-Source/m-p/147393#M30018</link>
      <description>&lt;P&gt;[monitor:///tmp/usr/local/sse/apache-ers/servers/aep.qa.abcd.org/logs/&lt;EM&gt;access.log&lt;/EM&gt;]&lt;BR /&gt;
blacklist = .(txt|gz)$&lt;BR /&gt;
sourcetype=apache&lt;/P&gt;

&lt;P&gt;Checked it like 20 times.&lt;/P&gt;</description>
      <pubDate>Fri, 02 May 2014 18:10:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Adding-a-field-and-changing-source-from-Source/m-p/147393#M30018</guid>
      <dc:creator>theouhuios</dc:creator>
      <dc:date>2014-05-02T18:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a field and changing source from Source</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Adding-a-field-and-changing-source-from-Source/m-p/147394#M30019</link>
      <description>&lt;P&gt;Made a mistake of sending the file from HF. Parsing was being done on HF and these configs were not there. Moved them to UF and works like a charm. &lt;/P&gt;

&lt;P&gt;Only change&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[replace_source_from_source]
SOURCE_KEY = MetaData:Source
REGEX = ^(\S+\.log)\.[^.]+$
FORMAT = source::$1 --&amp;gt; Change this to FORMAT = $1
DEST_KEY = MetaData:Source
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 May 2014 15:47:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Adding-a-field-and-changing-source-from-Source/m-p/147394#M30019</guid>
      <dc:creator>theouhuios</dc:creator>
      <dc:date>2014-05-08T15:47:57Z</dc:date>
    </item>
  </channel>
</rss>

