<?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 do you make a regex to remove a string from file path in inputs.conf? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-to-remove-a-string-from-file-path-in/m-p/412865#M118977</link>
    <description>&lt;P&gt;filename is dynamic. I want to modify source of event to this. splunk forwarder by default shows file path which is /var/log/syslog// with hostname and filename dynamic. I want it to be modified to /var/log/syslog/. need to remove  from file path.&lt;/P&gt;</description>
    <pubDate>Tue, 27 Nov 2018 22:57:33 GMT</pubDate>
    <dc:creator>meet_vadaria</dc:creator>
    <dc:date>2018-11-27T22:57:33Z</dc:date>
    <item>
      <title>How do you make a regex to remove a string from file path in inputs.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-to-remove-a-string-from-file-path-in/m-p/412863#M118975</link>
      <description>&lt;P&gt;I want to change a source by removing a "hostname" from file path (string) using inputs.conf&lt;/P&gt;

&lt;P&gt;Currently, the source is /var/log/syslog/&amp;lt;&lt;STRONG&gt;hostname&lt;/STRONG&gt;&amp;gt;/filename.&lt;/P&gt;

&lt;P&gt;What I am looking for is &lt;STRONG&gt;/var/log/syslog/filename&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;How do I remove "hostname" string from path? I need to add it to inputs.conf&lt;/P&gt;

&lt;P&gt;thanks in advance. &lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 22:32:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-to-remove-a-string-from-file-path-in/m-p/412863#M118975</guid>
      <dc:creator>meet_vadaria</dc:creator>
      <dc:date>2018-11-27T22:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do you make a regex to remove a string from file path in inputs.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-to-remove-a-string-from-file-path-in/m-p/412864#M118976</link>
      <description>&lt;P&gt;@meet_vadaria, which path would you like to monitor? If it's &lt;CODE&gt;/var/log/syslog/filename&lt;/CODE&gt; can't you &lt;STRONG&gt;just&lt;/STRONG&gt; specify it as such in &lt;CODE&gt;input.conf&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 22:53:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-to-remove-a-string-from-file-path-in/m-p/412864#M118976</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2018-11-27T22:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: How do you make a regex to remove a string from file path in inputs.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-to-remove-a-string-from-file-path-in/m-p/412865#M118977</link>
      <description>&lt;P&gt;filename is dynamic. I want to modify source of event to this. splunk forwarder by default shows file path which is /var/log/syslog// with hostname and filename dynamic. I want it to be modified to /var/log/syslog/. need to remove  from file path.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 22:57:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-to-remove-a-string-from-file-path-in/m-p/412865#M118977</guid>
      <dc:creator>meet_vadaria</dc:creator>
      <dc:date>2018-11-27T22:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do you make a regex to remove a string from file path in inputs.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-to-remove-a-string-from-file-path-in/m-p/412866#M118978</link>
      <description>&lt;P&gt;At the level of &lt;CODE&gt;input.conf&lt;/CODE&gt;, you can use the &lt;CODE&gt;*&lt;/CODE&gt; and &lt;CODE&gt;...&lt;/CODE&gt; wildcards.  If needed, you can change &lt;CODE&gt;source&lt;/CODE&gt; later during index time.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 23:05:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-to-remove-a-string-from-file-path-in/m-p/412866#M118978</guid>
      <dc:creator>ddrillic</dc:creator>
      <dc:date>2018-11-27T23:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do you make a regex to remove a string from file path in inputs.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-to-remove-a-string-from-file-path-in/m-p/412867#M118979</link>
      <description>&lt;P&gt;I think you are not getting my point. here is example of my input.conf on splunk forwarder.&lt;/P&gt;

&lt;P&gt;[monitor:///var/log/syslog//]&lt;BR /&gt;
host_segment = 4&lt;BR /&gt;
sourcetype = xxx&lt;/P&gt;

&lt;P&gt;this input.conf monitors all log files sitting under /var/log/syslog// directory. let's say I have 3 log files there as foo.log, bar.log, xxx.log&lt;/P&gt;

&lt;P&gt;now my default source in splunk for this logs(events) will be /var/log/syslog//foo.log or specific log file&lt;/P&gt;

&lt;P&gt;I want to change it to /var/log/syslog/foo.log. I believe I can do it in input.conf by using regex. I guess I can have a regex to remove  string from  /var/log/syslog//foo.log and it will be right way to do in input.conf&lt;/P&gt;

&lt;P&gt;I don't know how to do it in indexing time. &lt;/P&gt;</description>
      <pubDate>Tue, 27 Nov 2018 23:23:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-to-remove-a-string-from-file-path-in/m-p/412867#M118979</guid>
      <dc:creator>meet_vadaria</dc:creator>
      <dc:date>2018-11-27T23:23:36Z</dc:date>
    </item>
    <item>
      <title>Re: How do you make a regex to remove a string from file path in inputs.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-to-remove-a-string-from-file-path-in/m-p/412868#M118980</link>
      <description>&lt;P&gt;You should be able to do it with transforms.  See transforms.conf.example.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[hostoverride]
REGEX = (\/var\/log\/syslog\/)[^\/]+(\/filename)
FORMAT = host::$1$2
DEST_KEY = MetaData:Host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Nov 2018 03:55:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-to-remove-a-string-from-file-path-in/m-p/412868#M118980</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-11-28T03:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do you make a regex to remove a string from file path in inputs.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-to-remove-a-string-from-file-path-in/m-p/412869#M118981</link>
      <description>&lt;P&gt;I think this block is to change Host filed of events. I am trying to change Source field. I don't see any documents regarding that. I found splunk documents mentioning I can change source type with transforms.conf and props.conf but not source. &lt;/P&gt;

&lt;P&gt;any idea if we can change Source using transforms.conf and props.conf?&lt;/P&gt;

&lt;P&gt;transforms.conf&lt;BR /&gt;
[set_sourcetype_my_log_for_some_hosts]&lt;BR /&gt;
REGEX = :\d\d\s+(?:\d+\s+|(?:user|daemon|local.?).\w+\s+)&lt;EM&gt;[?(host1|host2|host3)[\w.-]&lt;/EM&gt;]?\s&lt;BR /&gt;
FORMAT = sourcetype::my_log&lt;BR /&gt;
DEST_KEY = MetaData:Sourcetype&lt;/P&gt;

&lt;P&gt;props.conf&lt;BR /&gt;
[source::udp:514]&lt;BR /&gt;
TRANSFORMS-changesourcetype = set_sourcetype_my_log_for_some_hosts&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0/Data/Advancedsourcetypeoverrides" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/5.0/Data/Advancedsourcetypeoverrides&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 22:12:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-to-remove-a-string-from-file-path-in/m-p/412869#M118981</guid>
      <dc:creator>meet_vadaria</dc:creator>
      <dc:date>2020-09-29T22:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do you make a regex to remove a string from file path in inputs.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-to-remove-a-string-from-file-path-in/m-p/412870#M118982</link>
      <description>&lt;P&gt;I am trying to override source field of syslog. I think given block will help me to override host field. i tried for source by modifying little bit. still can't get it working. &lt;/P&gt;

&lt;P&gt;input.conf&lt;BR /&gt;
[monitor:///var/log/syslog/]&lt;BR /&gt;
host_segment = 4&lt;BR /&gt;
sourcetype = xxx&lt;/P&gt;

&lt;P&gt;transforms.conf&lt;BR /&gt;
[sourceoverride]&lt;BR /&gt;
REGEX = (\/var\/log\/syslog\/)[^\/]+(\/filename)&lt;BR /&gt;
FORMATE = source::$1$2&lt;BR /&gt;
DEST_KEY = MetaData:Source&lt;/P&gt;

&lt;P&gt;props.conf&lt;BR /&gt;
[source::/var/log/syslog/]&lt;BR /&gt;
TRANSFORMS-changesource = sourceoverride&lt;/P&gt;

&lt;P&gt;I have config as above.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Nov 2018 18:40:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-to-remove-a-string-from-file-path-in/m-p/412870#M118982</guid>
      <dc:creator>meet_vadaria</dc:creator>
      <dc:date>2018-11-28T18:40:05Z</dc:date>
    </item>
    <item>
      <title>Re: How do you make a regex to remove a string from file path in inputs.conf?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-to-remove-a-string-from-file-path-in/m-p/412871#M118983</link>
      <description>&lt;P&gt;Sorry for misreading your question.  Your modifications look good.  Be careful, however, of the REGEX string.  Make sure it matches your file paths.  "filename", for example, is taken from your question, but is probably not part of the file path.  You should modify it accordingly.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Nov 2018 14:07:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-you-make-a-regex-to-remove-a-string-from-file-path-in/m-p/412871#M118983</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2018-11-29T14:07:22Z</dc:date>
    </item>
  </channel>
</rss>

