<?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 sourcetype and source fields dynamically via inputs.conf in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Setting-sourcetype-and-source-fields-dynamically-via-inputs-conf/m-p/20694#M3027</link>
    <description>&lt;P&gt;Well, perhaps this may not be applicable for you, but you can set the sourcetype somewhat dynamically with props.conf rules. This will examine the content of a file and set the sourcetype if the rules match.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[rule::bar_some]
sourcetype = source_with_lots_of_bars
# if more than 80% of lines have "----", but fewer than 70% have "####" declare this a
# "source_with_lots_of_bars"
MORE_THAN_80 = ----
LESS_THAN_70 = ####
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;A rule can have many &lt;CODE&gt;MORE_THAN&lt;/CODE&gt; and &lt;CODE&gt;LESS_THAN&lt;/CODE&gt; patterns, and all are required for the rule&lt;BR /&gt;
to match.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps,&lt;/P&gt;

&lt;P&gt;Kristian&lt;/P&gt;</description>
    <pubDate>Fri, 06 Apr 2012 11:15:29 GMT</pubDate>
    <dc:creator>kristian_kolb</dc:creator>
    <dc:date>2012-04-06T11:15:29Z</dc:date>
    <item>
      <title>Setting sourcetype and source fields dynamically via inputs.conf</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Setting-sourcetype-and-source-fields-dynamically-via-inputs-conf/m-p/20692#M3025</link>
      <description>&lt;P&gt;I was reading the docs for inputs.conf and noticed that there are host _regex and host _segment attributes to the monitor stanzas. I want to be able to set the source and sourcetype attributes with a regex (just like host _regex and host _segment) as well. I know you can set it in transforms.conf, but I need to be able to set it on a per-file basis, not a per-event basis. &lt;/P&gt;

&lt;P&gt;Does anyone have any ideas as to how to accomplish this?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2012 22:10:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Setting-sourcetype-and-source-fields-dynamically-via-inputs-conf/m-p/20692#M3025</guid>
      <dc:creator>nterry</dc:creator>
      <dc:date>2012-04-05T22:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: Setting sourcetype and source fields dynamically via inputs.conf</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Setting-sourcetype-and-source-fields-dynamically-via-inputs-conf/m-p/20693#M3026</link>
      <description>&lt;P&gt;You can only set source and sourcetype to a fixed string in inputs.conf. You cannot set it to be a regex or segment of the pathname. To set to a fixed string, use &lt;CODE&gt;source = ...&lt;/CODE&gt; or &lt;CODE&gt;sourcetype = ...&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2012 03:05:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Setting-sourcetype-and-source-fields-dynamically-via-inputs-conf/m-p/20693#M3026</guid>
      <dc:creator>Stephen_Sorkin</dc:creator>
      <dc:date>2012-04-06T03:05:39Z</dc:date>
    </item>
    <item>
      <title>Re: Setting sourcetype and source fields dynamically via inputs.conf</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Setting-sourcetype-and-source-fields-dynamically-via-inputs-conf/m-p/20694#M3027</link>
      <description>&lt;P&gt;Well, perhaps this may not be applicable for you, but you can set the sourcetype somewhat dynamically with props.conf rules. This will examine the content of a file and set the sourcetype if the rules match.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[rule::bar_some]
sourcetype = source_with_lots_of_bars
# if more than 80% of lines have "----", but fewer than 70% have "####" declare this a
# "source_with_lots_of_bars"
MORE_THAN_80 = ----
LESS_THAN_70 = ####
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;A rule can have many &lt;CODE&gt;MORE_THAN&lt;/CODE&gt; and &lt;CODE&gt;LESS_THAN&lt;/CODE&gt; patterns, and all are required for the rule&lt;BR /&gt;
to match.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf"&gt;http://docs.splunk.com/Documentation/Splunk/latest/Admin/Propsconf&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps,&lt;/P&gt;

&lt;P&gt;Kristian&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2012 11:15:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Setting-sourcetype-and-source-fields-dynamically-via-inputs-conf/m-p/20694#M3027</guid>
      <dc:creator>kristian_kolb</dc:creator>
      <dc:date>2012-04-06T11:15:29Z</dc:date>
    </item>
  </channel>
</rss>

