<?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 Change source file name while indexing in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Change-source-file-name-while-indexing/m-p/461134#M79590</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a source file something like this Samplefile_Infobar_20200331 and I would like to view the source as &lt;STRONG&gt;Samplefile_Infobar_2020-03-31&lt;/STRONG&gt; on Splunk search head (With hyphens between the yyyymmdd). How to do it.&lt;/P&gt;

&lt;P&gt;Thanks &lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 04:47:22 GMT</pubDate>
    <dc:creator>splunkwar</dc:creator>
    <dc:date>2020-09-30T04:47:22Z</dc:date>
    <item>
      <title>Change source file name while indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Change-source-file-name-while-indexing/m-p/461134#M79590</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have a source file something like this Samplefile_Infobar_20200331 and I would like to view the source as &lt;STRONG&gt;Samplefile_Infobar_2020-03-31&lt;/STRONG&gt; on Splunk search head (With hyphens between the yyyymmdd). How to do it.&lt;/P&gt;

&lt;P&gt;Thanks &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:47:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Change-source-file-name-while-indexing/m-p/461134#M79590</guid>
      <dc:creator>splunkwar</dc:creator>
      <dc:date>2020-09-30T04:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: Change source file name while indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Change-source-file-name-while-indexing/m-p/461135#M79591</link>
      <description>&lt;P&gt;hi @ splunkwar&lt;BR /&gt;
try something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval source="Samplefile_Infobar_20200331.log"
| rex field=source "^(?&amp;lt;prefix&amp;gt;.*)(?&amp;lt;year&amp;gt;\d\d\d\d)(?&amp;lt;month&amp;gt;\d\d)(?&amp;lt;day&amp;gt;\d\d)(?&amp;lt;ext&amp;gt;.*)"
| eval source_final=prefix.year."-".month."-".day.ext
| table source source_final
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2020 12:04:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Change-source-file-name-while-indexing/m-p/461135#M79591</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-03-30T12:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: Change source file name while indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Change-source-file-name-while-indexing/m-p/461136#M79592</link>
      <description>&lt;P&gt;Thanks @gcusello , is there a way to achieve same before indexing ?&lt;BR /&gt;
thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2020 12:22:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Change-source-file-name-while-indexing/m-p/461136#M79592</guid>
      <dc:creator>splunkwar</dc:creator>
      <dc:date>2020-03-30T12:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: Change source file name while indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Change-source-file-name-while-indexing/m-p/461137#M79593</link>
      <description>&lt;P&gt;hi @splunkwar,&lt;BR /&gt;
I cannot test it, so try something like this:&lt;BR /&gt;
&lt;STRONG&gt;transforms.conf&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[source_override]
REGEX = ^(.*)_(\d\d\d\d)(\d\d)(\d\d)(.*)
FORMAT = source::$1_$2-$3-$4$5
SOURCE_KEY=MetaData:Source
DEST_KEY = MetaData:Source
&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;[your_sourcetype]
REPORT-source = source_override
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2020 14:09:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Change-source-file-name-while-indexing/m-p/461137#M79593</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-03-30T14:09:59Z</dc:date>
    </item>
    <item>
      <title>Re: Change source file name while indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Change-source-file-name-while-indexing/m-p/461138#M79594</link>
      <description>&lt;P&gt;Thanks, it works. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2020 14:47:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Change-source-file-name-while-indexing/m-p/461138#M79594</guid>
      <dc:creator>splunkwar</dc:creator>
      <dc:date>2020-03-30T14:47:35Z</dc:date>
    </item>
    <item>
      <title>Re: Change source file name while indexing</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Change-source-file-name-while-indexing/m-p/461139#M79595</link>
      <description>&lt;P&gt;You're welcome!&lt;BR /&gt;
See next time!&lt;BR /&gt;
ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 30 Mar 2020 15:16:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Change-source-file-name-while-indexing/m-p/461139#M79595</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-03-30T15:16:40Z</dc:date>
    </item>
  </channel>
</rss>

