<?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 How to extract filename form   Source field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-filename-form-Source-field/m-p/112492#M29556</link>
    <description>&lt;P&gt;Hi team,&lt;/P&gt;

&lt;P&gt;I have got a csv files indexed into splunk with names  SOURCE= C:\Netwrokanalysis\germany.csv ,c:\networkanalysis\singapore.csv  i want to extract country name form this SOURCE field that is germany,singapore&lt;/P&gt;

&lt;P&gt;Thanks ,&lt;BR /&gt;
Deepthi &lt;/P&gt;</description>
    <pubDate>Fri, 10 Jul 2015 08:01:16 GMT</pubDate>
    <dc:creator>deepthi5</dc:creator>
    <dc:date>2015-07-10T08:01:16Z</dc:date>
    <item>
      <title>How to extract filename form   Source field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-filename-form-Source-field/m-p/112492#M29556</link>
      <description>&lt;P&gt;Hi team,&lt;/P&gt;

&lt;P&gt;I have got a csv files indexed into splunk with names  SOURCE= C:\Netwrokanalysis\germany.csv ,c:\networkanalysis\singapore.csv  i want to extract country name form this SOURCE field that is germany,singapore&lt;/P&gt;

&lt;P&gt;Thanks ,&lt;BR /&gt;
Deepthi &lt;/P&gt;</description>
      <pubDate>Fri, 10 Jul 2015 08:01:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-filename-form-Source-field/m-p/112492#M29556</guid>
      <dc:creator>deepthi5</dc:creator>
      <dc:date>2015-07-10T08:01:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract filename form   Source field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-filename-form-Source-field/m-p/112493#M29557</link>
      <description>&lt;P&gt;I'm sure there is a more elegant solution, but would something like &lt;CODE&gt;| eval country = mvindex(split(substr(source,18),"."),0)&lt;/CODE&gt; work?&lt;/P&gt;

&lt;P&gt;Edit: This should work as well&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;rex field=source "c:networkanalysis(?&amp;lt;country&amp;gt;\S+).csv"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 10 Jul 2015 09:35:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-filename-form-Source-field/m-p/112493#M29557</guid>
      <dc:creator>sc0tt</dc:creator>
      <dc:date>2015-07-10T09:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract filename form   Source field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-filename-form-Source-field/m-p/112494#M29558</link>
      <description>&lt;P&gt;I didn't test it but it should work if the length of the first part of the SOURCE string is always the same.&lt;BR /&gt;
You can also apply a rex command after applying the split command, but it will do the same than the command proposed by sc0tt &lt;/P&gt;</description>
      <pubDate>Fri, 10 Jul 2015 09:46:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-filename-form-Source-field/m-p/112494#M29558</guid>
      <dc:creator>joao_amorim</dc:creator>
      <dc:date>2015-07-10T09:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract filename form   Source field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-filename-form-Source-field/m-p/112495#M29559</link>
      <description>&lt;P&gt;Also assigning different &lt;STRONG&gt;sourcetype&lt;/STRONG&gt; per county csv file is other option  and you can handle it better for your future search queries. &lt;/P&gt;

&lt;P&gt;In your &lt;STRONG&gt;input.conf&lt;/STRONG&gt; file;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[monitor://C:\networkanalysisgermany.csv]
disabled = false
sourcetype = Germany

[monitor://C:\networkanalysissingapore.csv]
disabled = false
sourcetype = Singapore
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/Data/Createsourcetypes"&gt;Create Sourcetypes&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Hope it helps&lt;/P&gt;

&lt;P&gt;Gokhan&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jul 2015 09:48:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-filename-form-Source-field/m-p/112495#M29559</guid>
      <dc:creator>gyarici</dc:creator>
      <dc:date>2015-07-10T09:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract filename form   Source field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-filename-form-Source-field/m-p/112496#M29560</link>
      <description>&lt;P&gt;This is probably the best solution.&lt;/P&gt;</description>
      <pubDate>Fri, 10 Jul 2015 09:53:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-filename-form-Source-field/m-p/112496#M29560</guid>
      <dc:creator>sc0tt</dc:creator>
      <dc:date>2015-07-10T09:53:46Z</dc:date>
    </item>
  </channel>
</rss>

