<?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: Field transformation based on source in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Field-transformation-based-on-source/m-p/197072#M39156</link>
    <description>&lt;P&gt;You could also just add &lt;CODE&gt;in source&lt;/CODE&gt; after the end of the field extraction regex when editing it through the UI.&lt;/P&gt;</description>
    <pubDate>Sat, 14 Jun 2014 18:50:59 GMT</pubDate>
    <dc:creator>martin_mueller</dc:creator>
    <dc:date>2014-06-14T18:50:59Z</dc:date>
    <item>
      <title>Field transformation based on source</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Field-transformation-based-on-source/m-p/197066#M39150</link>
      <description>&lt;P&gt;Hi All, &lt;/P&gt;

&lt;P&gt;We log data from devices belonging to different customers, they are written to our syslog server in files named /data/log/CUSTOMER/site/router1.log, for example. I wanted to have a search-time field called &lt;STRONG&gt;customer&lt;/STRONG&gt; with the value &lt;STRONG&gt;CUSTOMER&lt;/STRONG&gt;, taken from the source filename. &lt;/P&gt;

&lt;P&gt;I did this via the web GUI, under Settings/Fields/Field Transformation, this is what was written in $SPLUNK_HOME/etc/apps/search/local/transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[get_customer]
FORMAT = customer::$1
REGEX = \/data\/log\/(.*)\/site.*
SOURCE_KEY = MetaData:Source
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Unfortunately nothing happens, I get no field named &lt;STRONG&gt;customer&lt;/STRONG&gt; when I search. From what I can tell, the regex is correct. I also tried just "source" as SOURCE_KEY but nothing changed. Is anything wrong with my transform ?&lt;/P&gt;

&lt;P&gt;I am also not sure how this transform is applied, is it run against log messages arriving via all indexes ?&lt;/P&gt;

&lt;P&gt;As additional info, we are running splunk on a separate server (so basically the indexer) and we use a light forwarder on our syslog server. The transform above is done on the indexer. &lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Stefan&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jun 2014 09:30:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Field-transformation-based-on-source/m-p/197066#M39150</guid>
      <dc:creator>stefan_radovano</dc:creator>
      <dc:date>2014-06-12T09:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: Field transformation based on source</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Field-transformation-based-on-source/m-p/197067#M39151</link>
      <description>&lt;P&gt;Did you specify a &lt;CODE&gt;REPORT-foo = get_customer&lt;/CODE&gt; entry in props.conf for that sourcetype?&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jun 2014 21:34:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Field-transformation-based-on-source/m-p/197067#M39151</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-06-13T21:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: Field transformation based on source</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Field-transformation-based-on-source/m-p/197068#M39152</link>
      <description>&lt;P&gt;In props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[your_sourcetype]
EXTRACT = \/data\/log\/(?&amp;lt;customer&amp;gt;\w+)\/site.* in source
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;No need to touch transforms.conf for this.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jun 2014 22:10:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Field-transformation-based-on-source/m-p/197068#M39152</guid>
      <dc:creator>emechler_splunk</dc:creator>
      <dc:date>2014-06-13T22:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: Field transformation based on source</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Field-transformation-based-on-source/m-p/197069#M39153</link>
      <description>&lt;P&gt;Yes, I do have that too.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jun 2014 12:37:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Field-transformation-based-on-source/m-p/197069#M39153</guid>
      <dc:creator>stefan_radovano</dc:creator>
      <dc:date>2014-06-14T12:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Field transformation based on source</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Field-transformation-based-on-source/m-p/197070#M39154</link>
      <description>&lt;P&gt;I actually tried to do this via GUI (Fields/Field Extraction) but when I chose "source" for "Apply To", it also wanted me to specify &lt;EM&gt;which&lt;/EM&gt; source. I obviously didn't want to restrict it to one particular source, didn't know what to put in there. Was I doing something wrong ?&lt;/P&gt;

&lt;P&gt;In any case, this worked. I just had to restart splunk. Is there no way around restarting ?&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jun 2014 13:15:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Field-transformation-based-on-source/m-p/197070#M39154</guid>
      <dc:creator>stefan_radovano</dc:creator>
      <dc:date>2014-06-14T13:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: Field transformation based on source</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Field-transformation-based-on-source/m-p/197071#M39155</link>
      <description>&lt;P&gt;You can do this in SPL itself:&lt;/P&gt;

&lt;P&gt;| extract reload=t&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jun 2014 16:41:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Field-transformation-based-on-source/m-p/197071#M39155</guid>
      <dc:creator>emechler_splunk</dc:creator>
      <dc:date>2014-06-14T16:41:59Z</dc:date>
    </item>
    <item>
      <title>Re: Field transformation based on source</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Field-transformation-based-on-source/m-p/197072#M39156</link>
      <description>&lt;P&gt;You could also just add &lt;CODE&gt;in source&lt;/CODE&gt; after the end of the field extraction regex when editing it through the UI.&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jun 2014 18:50:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Field-transformation-based-on-source/m-p/197072#M39156</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2014-06-14T18:50:59Z</dc:date>
    </item>
  </channel>
</rss>

