<?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: How to set Source equal to filename in input.conf? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-set-Source-equal-to-filename-in-input-conf/m-p/229725#M44703</link>
    <description>&lt;P&gt;The source of an event is the name of the file, stream, or other input from which the event originates. For data monitored from files and directories, the value of source is the full path, such as /archive/server1/var/log/messages.0 or /var/log/. The value of source for network-based data sources is the protocol and port, such as UDP:514&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.0/Data/Aboutdefaultfields"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.0/Data/Aboutdefaultfields&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Oct 2016 20:58:23 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2016-10-04T20:58:23Z</dc:date>
    <item>
      <title>How to set Source equal to filename in input.conf?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-set-Source-equal-to-filename-in-input-conf/m-p/229724#M44702</link>
      <description>&lt;P&gt;There are a lot of documentation on how to set Host equal to filename or directory name, however i couldn't find anything on how to set source equal to file name? &lt;/P&gt;

&lt;P&gt;[monitor://.......\fil.log]&lt;BR /&gt;
disabled=0&lt;BR /&gt;
source=???&lt;BR /&gt;
sourcetype= logFile&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;P&gt;[logFile]&lt;BR /&gt;
setting&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;BR /&gt;
.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2016 20:56:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-set-Source-equal-to-filename-in-input-conf/m-p/229724#M44702</guid>
      <dc:creator>moaf13</dc:creator>
      <dc:date>2016-10-04T20:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to set Source equal to filename in input.conf?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-set-Source-equal-to-filename-in-input-conf/m-p/229725#M44703</link>
      <description>&lt;P&gt;The source of an event is the name of the file, stream, or other input from which the event originates. For data monitored from files and directories, the value of source is the full path, such as /archive/server1/var/log/messages.0 or /var/log/. The value of source for network-based data sources is the protocol and port, such as UDP:514&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.5.0/Data/Aboutdefaultfields"&gt;http://docs.splunk.com/Documentation/Splunk/6.5.0/Data/Aboutdefaultfields&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2016 20:58:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-set-Source-equal-to-filename-in-input-conf/m-p/229725#M44703</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-10-04T20:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to set Source equal to filename in input.conf?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-set-Source-equal-to-filename-in-input-conf/m-p/229726#M44704</link>
      <description>&lt;P&gt;Thank you for answering, but this is what I have &lt;/P&gt;

&lt;P&gt;[monitor://E:\Users\Documents\fil.txt]&lt;BR /&gt;
disabled=0&lt;BR /&gt;
Sourcetype = WindowsFile&lt;BR /&gt;
queue = parsingQueue&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;P&gt;[WindowsFile]&lt;BR /&gt;
bunch of setting.....&lt;/P&gt;

&lt;P&gt;[source::E:\Users\Documents\fil.txt]&lt;BR /&gt;
TRANSFORMS-replace_source = replacedefaultsource&lt;/P&gt;

&lt;P&gt;Tranforms.conf&lt;/P&gt;

&lt;P&gt;[replacedefaultsource]&lt;BR /&gt;
SOURCE_KEY = MetaData:Source&lt;BR /&gt;
REGEX = E:\Users\(Documents)\fil.txt&lt;BR /&gt;
DEST_KEY = MetaData:Source&lt;BR /&gt;
FORMAT= source::$1&lt;/P&gt;

&lt;P&gt;That's the setting that i have and it's not working, I don't want to full path, I just want the filename. this is what i have and it's not working? &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:16:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-set-Source-equal-to-filename-in-input-conf/m-p/229726#M44704</guid>
      <dc:creator>moaf13</dc:creator>
      <dc:date>2020-09-29T11:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to set Source equal to filename in input.conf?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-set-Source-equal-to-filename-in-input-conf/m-p/229727#M44705</link>
      <description>&lt;P&gt;Try this as the REGEX in  your transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[replacedefaultsource]
SOURCE_KEY = MetaData:Source
REGEX = E:\\Users\\([^\\]+)\\fil.txt
DEST_KEY = MetaData:Source
FORMAT= source::$1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 05 Oct 2016 01:36:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-set-Source-equal-to-filename-in-input-conf/m-p/229727#M44705</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-05T01:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to set Source equal to filename in input.conf?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-set-Source-equal-to-filename-in-input-conf/m-p/229728#M44706</link>
      <description>&lt;P&gt;Thank you very much. That's exactly what i was looking for. &lt;/P&gt;

&lt;P&gt;I also added another change which was removing  [source::E:\Users\Documents\fil.txt] entirly from props.conf and moving TRANSFORMS-replace_source  to sourcetype setting for anyone looking at this answer in the future. &lt;/P&gt;

&lt;P&gt;[WindowsFile]&lt;BR /&gt;
bunch of setting.....&lt;BR /&gt;
TRANSFORMS-replace_source = replacedefaultsource&lt;/P&gt;

&lt;P&gt;removed ([source::E:\Users\Documents\fil.txt]&lt;BR /&gt;
TRANSFORMS-replace_source = replacedefaultsource)&lt;/P&gt;

&lt;P&gt;Do you know why I had to do that? does splunk prioritize sourcetype setting than other settings in props.conf? &lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2016 08:43:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-set-Source-equal-to-filename-in-input-conf/m-p/229728#M44706</guid>
      <dc:creator>moaf13</dc:creator>
      <dc:date>2016-10-05T08:43:36Z</dc:date>
    </item>
  </channel>
</rss>

