<?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: Can I configure the source in the inputs.conf file? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-configure-the-source-in-the-inputs-conf-file/m-p/180954#M36309</link>
    <description>&lt;P&gt;Thanks, this is very helpful.&lt;/P&gt;</description>
    <pubDate>Mon, 29 Jun 2015 13:26:58 GMT</pubDate>
    <dc:creator>andrewcg</dc:creator>
    <dc:date>2015-06-29T13:26:58Z</dc:date>
    <item>
      <title>Can I configure the source in the inputs.conf file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-configure-the-source-in-the-inputs-conf-file/m-p/180949#M36304</link>
      <description>&lt;P&gt;This is on a forwarder.  We have two forwarders receiving syslog from some appliances. The forwarders write the syslog to disk and then the Splunk forwarder monitors for the files.  The input stanza is:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[monitor:///opt/inboundlogs/10.10.10.10/*_syslog.log]
host = 10.10.10.10
disabled = false
source = $HOSTNAME 10.10.10.10
sourcetype = vm_app
index = app_foo
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The file name is &lt;CODE&gt;/opt/inboundlogs/10.10.10.10/YYYY-MM-DD-HH_10.10.10.10_syslog.log&lt;/CODE&gt; and now our Splunk server is getting full of sourcetypes.&lt;/P&gt;

&lt;P&gt;I have set HOSTNAME in splunk-launch.conf  and can see that Splunk sees it:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;/opt/splunkforwarder/bin/splunk&lt;/CODE&gt; envvars&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;HOSTNAME=FORWARDER-01 ; export HOSTNAME ; PATH=/opt/splunkforwarder/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/splunk/bin ; export PATH ; SPLUNK_HOME=/opt/splunkforwarder ; export SPLUNK_HOME ; SPLUNK_DB=/opt/splunkforwarder/var/lib/splunk ; export SPLUNK_DB ; SPLUNK_SERVER_NAME=SplunkForwarder ; export SPLUNK_SERVER_NAME ; SPLUNK_WEB_NAME=splunkweb ; export SPLUNK_WEB_NAME ; LD_LIBRARY_PATH=/opt/splunkforwarder/lib ; export LD_LIBRARY_PATH ; OPENSSL_CONF=/opt/splunkforwarder/openssl/openssl.cnf ; export OPENSSL_CONF ; LDAPCONF=/opt/splunkforwarder/etc/openldap/ldap.conf ; export LDAPCONF
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And updated the stanza to:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[monitor:///opt/inboundlogs/10.10.10.10/*_syslog.log]
host = 10.10.10.10
disabled = false
source = $HOSTNAME 10.10.10.10
sourcetype = vm_app
index = app_foo
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But on the Splunk indexer, the source is "$HOSTNAME 10.10.10.10" and not "FORWARDER-01 10.10.10.10".&lt;/P&gt;

&lt;P&gt;I am planning on rolling this config into a Spunk App for easy management of the multiple forwarders receiving and forwarding on this syslog data, so I need the &lt;CODE&gt;app/default/inputs.conf&lt;/CODE&gt; to be general and then I can set server specific settings with environment variables in the splunk-launch.conf.  Using the &lt;CODE&gt;app/local/inputs.conf&lt;/CODE&gt; to set this would suck, as there are currently eight incoming syslog streams, and more to come.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jun 2015 22:36:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-configure-the-source-in-the-inputs-conf-file/m-p/180949#M36304</guid>
      <dc:creator>andrewcg</dc:creator>
      <dc:date>2015-06-26T22:36:14Z</dc:date>
    </item>
    <item>
      <title>Re: Can I configure the source in the inputs.conf file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-configure-the-source-in-the-inputs-conf-file/m-p/180950#M36305</link>
      <description>&lt;P&gt;So am going to change the source to forwarder::hostname.  I can easily do this by setting the default source to forwarder::hostname in the app/local/inputs.conf file and not setting a source on the individual folder monitors.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[default]
host = myserver
source = forwarder::myserver
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I really would like to use the environment variable, but this works for now.&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jun 2015 00:39:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-configure-the-source-in-the-inputs-conf-file/m-p/180950#M36305</guid>
      <dc:creator>andrewcg</dc:creator>
      <dc:date>2015-06-27T00:39:52Z</dc:date>
    </item>
    <item>
      <title>Re: Can I configure the source in the inputs.conf file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-configure-the-source-in-the-inputs-conf-file/m-p/180951#M36306</link>
      <description>&lt;P&gt;I suggest you set sourcetype to syslog and don't specify the source.&lt;/P&gt;

&lt;P&gt;If this is a heavy forwarder you can add a metadata field such as "intermediate_forwarder" or similar to tag which forwarder the event was passed through. See gkpanaty's answer in &lt;A href="http://answers.splunk.com/answers/1453/how-do-i-add-metadata-to-events-coming-from-a-splunk-forwarder.html"&gt;http://answers.splunk.com/answers/1453/how-do-i-add-metadata-to-events-coming-from-a-splunk-forwarder.html&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;The props.conf and transforms.conf part is what you want to look at.&lt;/P&gt;

&lt;P&gt;Unfortunately there's no way to use an environment variable this way, so you'll have to specify the value in transforms.conf on the intermediate forwarders.&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jun 2015 07:46:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-configure-the-source-in-the-inputs-conf-file/m-p/180951#M36306</guid>
      <dc:creator>mikaelbje</dc:creator>
      <dc:date>2015-06-27T07:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can I configure the source in the inputs.conf file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-configure-the-source-in-the-inputs-conf-file/m-p/180952#M36307</link>
      <description>&lt;P&gt;For starters, I don't think Splunk can arbitrarily expand environment variables in every possible place in a .conf file.  Some places will expand &lt;CODE&gt;$SPLUNK_HOME&lt;/CODE&gt;, but I don't think this is universal.  You should learn about either &lt;CODE&gt;host_segment&lt;/CODE&gt; or &lt;CODE&gt;host_regex&lt;/CODE&gt; options in inputs.conf to automatically grab your &lt;CODE&gt;hostname=&lt;/CODE&gt; for you.  This way, you do not have to hardcode a stanza for each host.&lt;/P&gt;

&lt;P&gt;I don't think that adding the 'originating forwarder' to the &lt;CODE&gt;source&lt;/CODE&gt; field is necessarily the best idea either.  Some of the solutions that @mikaelbje provides links to can help.  One solution I like is to add a completely new indexed field of &lt;CODE&gt;syslog_receiver&lt;/CODE&gt; or similar.  So we would wind up with:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(inputs.conf)
[monitor:///opt/inboundlogs/*/*_syslog.log]
syslog_receiver = syslog_server_1_hostname
host_segment=3


(props.conf)
[source::/opt/inboundlogs/*/*_syslog.log]
TRANSFORMS-addreceiver = addreceiver


(transforms.conf)
[addreceiver]
SOURCE_KEY = syslog_receiver
REGEX = (.*)
FORMAT = syslog_receiver::$1
WRITE_META = true

(fields.conf)
[syslog_receiver]
INDEXED=true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It doesn't answer the question you asked, but it solves the problem you want to solve while reducing your number of hardcodes to one - which is the name of the &lt;CODE&gt;syslog_receiver&lt;/CODE&gt;.  And with proper configuration-file-overlaying, this is not an issue at all.  For example you could have a &lt;CODE&gt;$SPLUNK_HOME/etc/system/local/inputs.conf&lt;/CODE&gt; with&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[default]
syslog_receiver = forwarder_host_name
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And then the .conf layering just handles it for you.&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jun 2015 14:34:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-configure-the-source-in-the-inputs-conf-file/m-p/180952#M36307</guid>
      <dc:creator>dwaddle</dc:creator>
      <dc:date>2015-06-27T14:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: Can I configure the source in the inputs.conf file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-configure-the-source-in-the-inputs-conf-file/m-p/180953#M36308</link>
      <description>&lt;P&gt;Would the part with syslog_receiver in a monitor stanza in inputs.conf really work? I believe you can't add extra indexed fields directly that way. It will work with the props and transforms stuff you pasted (and thst's all you need), but to my knowledge the extra field and value you put in the monitor stanza won't do anything but give you an error message when restarting Splunk.&lt;/P&gt;</description>
      <pubDate>Sat, 27 Jun 2015 18:05:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-configure-the-source-in-the-inputs-conf-file/m-p/180953#M36308</guid>
      <dc:creator>mikaelbje</dc:creator>
      <dc:date>2015-06-27T18:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: Can I configure the source in the inputs.conf file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-configure-the-source-in-the-inputs-conf-file/m-p/180954#M36309</link>
      <description>&lt;P&gt;Thanks, this is very helpful.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jun 2015 13:26:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-configure-the-source-in-the-inputs-conf-file/m-p/180954#M36309</guid>
      <dc:creator>andrewcg</dc:creator>
      <dc:date>2015-06-29T13:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: Can I configure the source in the inputs.conf file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-configure-the-source-in-the-inputs-conf-file/m-p/180955#M36310</link>
      <description>&lt;P&gt;sorry for this change&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2015 12:27:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-configure-the-source-in-the-inputs-conf-file/m-p/180955#M36310</guid>
      <dc:creator>HamzaWhitehat</dc:creator>
      <dc:date>2015-06-30T12:27:43Z</dc:date>
    </item>
    <item>
      <title>Re: Can I configure the source in the inputs.conf file?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-configure-the-source-in-the-inputs-conf-file/m-p/180956#M36311</link>
      <description>&lt;P&gt;You can undo it by changing the topic back to what it was&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2015 12:39:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-configure-the-source-in-the-inputs-conf-file/m-p/180956#M36311</guid>
      <dc:creator>mikaelbje</dc:creator>
      <dc:date>2015-06-30T12:39:12Z</dc:date>
    </item>
  </channel>
</rss>

