<?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: Change sourcetype via field extraction and transforms in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396977#M94100</link>
    <description>&lt;P&gt;Hey,&lt;/P&gt;

&lt;P&gt;Exactly!&lt;BR /&gt;
I want data to be indexed in a different sourcetype when data arrives to the indexer.&lt;BR /&gt;
It's a clustered environnment and I have very limited rights as a user.&lt;BR /&gt;
REST API doesn't seem to be a suitable option.&lt;/P&gt;

&lt;P&gt;I will deploy a new splunk instance with full admin rights to try to modify directly transforms.conf and props.conf&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Tue, 02 Oct 2018 13:44:56 GMT</pubDate>
    <dc:creator>niboucher</dc:creator>
    <dc:date>2018-10-02T13:44:56Z</dc:date>
    <item>
      <title>Change sourcetype via field extraction and transforms</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396975#M94098</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;

&lt;P&gt;One of UF is configured to send logs to sourcetype testData.&lt;BR /&gt;
I'd like to push some of those logs matching a certain pattern (all logs matching the "[A][B]" pattern) to sourcetype testData_B.&lt;/P&gt;

&lt;P&gt;Sample of log&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[A][B] blabla
[A][C] blabla
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried to use transforms and field extraction but I couldn't make it work. I don't have ssh access so I did via the web interface&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Transformation&lt;/STRONG&gt;&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5843i398016DB59595A46/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Field extraction&lt;/STRONG&gt;&lt;BR /&gt;
&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/5844i7B4A2ABD2447ACCE/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;What's wrong with my setup?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 09:56:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396975#M94098</guid>
      <dc:creator>niboucher</dc:creator>
      <dc:date>2018-10-02T09:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: Change sourcetype via field extraction and transforms</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396976#M94099</link>
      <description>&lt;P&gt;Hi @niboucher,&lt;/P&gt;

&lt;P&gt;Do you want to index data in different sourcetype when it comes to Indexer ? Are you running single instance, distributed environment or clustered environment ?&lt;/P&gt;

&lt;P&gt;If you don't have ssh access to splunk server you can use REST API to do configuration on indexers but this approach is not suitable for clustered indexer, you can find Splunk SDK Python script on this &lt;A href="https://answers.splunk.com/answers/688049/how-do-i-alter-propsconf-via-python-sdk.html"&gt;answer&lt;/A&gt; to create props.conf configuration, similarly you can create configuration for transforms.conf (&lt;A href="https://answers.splunk.com/answers/686241/metadata-transforms-not-being-applied-after-series-1.html#answer-687394"&gt;Here&lt;/A&gt; is another answer which will help you to do configuration which you will require to rename sourcetype based on REGEX)&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 12:59:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396976#M94099</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-10-02T12:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: Change sourcetype via field extraction and transforms</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396977#M94100</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;

&lt;P&gt;Exactly!&lt;BR /&gt;
I want data to be indexed in a different sourcetype when data arrives to the indexer.&lt;BR /&gt;
It's a clustered environnment and I have very limited rights as a user.&lt;BR /&gt;
REST API doesn't seem to be a suitable option.&lt;/P&gt;

&lt;P&gt;I will deploy a new splunk instance with full admin rights to try to modify directly transforms.conf and props.conf&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 13:44:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396977#M94100</guid>
      <dc:creator>niboucher</dc:creator>
      <dc:date>2018-10-02T13:44:56Z</dc:date>
    </item>
    <item>
      <title>Re: Change sourcetype via field extraction and transforms</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396978#M94101</link>
      <description>&lt;P&gt;I tried to modify directly props.conf and transforms.conf and restart splunk but that didn't make it&lt;/P&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[testData_trans]
SOURCE_KEY = MetaData:Sourcetype
REGEX = (\[A\]\[B\].*)
FORMAT = sourcetype::testData_B
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [sourcetype::testData]
 TRANSFORMS-testProp = testData_trans
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Do you guys have any idea that could help me make this work?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Oct 2018 16:14:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396978#M94101</guid>
      <dc:creator>niboucher</dc:creator>
      <dc:date>2018-10-02T16:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: Change sourcetype via field extraction and transforms</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396979#M94102</link>
      <description>&lt;P&gt;Config should be like this&lt;/P&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[testData]
TRANSFORMS-testProp = testData_trans
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[testData_trans]
DEST_KEY = MetaData:Sourcetype
REGEX = (\[A\]\[B\].*)
FORMAT = sourcetype::testData_B
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Oct 2018 16:36:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396979#M94102</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-10-02T16:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: Change sourcetype via field extraction and transforms</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396980#M94103</link>
      <description>&lt;P&gt;That didn't work either.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;UF conf&lt;/STRONG&gt;&lt;BR /&gt;
inputs.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[monitor:///var/log/containers/*.log]
sourcetype = testData
recursive = false
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Indexer conf&lt;/STRONG&gt;&lt;BR /&gt;
props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [testData]
 TRANSFORMS-testProp = testData_trans
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; [testData_trans]
 DEST_KEY = MetaData:Sourcetype
 REGEX = (\[A\]\[B\].*)
 FORMAT = sourcetype::testData_B
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 03 Oct 2018 07:56:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396980#M94103</guid>
      <dc:creator>niboucher</dc:creator>
      <dc:date>2018-10-03T07:56:39Z</dc:date>
    </item>
    <item>
      <title>Re: Change sourcetype via field extraction and transforms</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396981#M94104</link>
      <description>&lt;P&gt;It should work, can you please try with &lt;CODE&gt;REGEX = \[A\]\[B\]&lt;/CODE&gt; in transforms.conf, don't forget to restart splunk. &lt;/P&gt;

&lt;P&gt;Additionally data which is already indexed with old sourcetype will not change only new data which will come to Indexer now onwards will have new sourcetype (Here I am guessing that UF is sending logs to Indexer directly and not via Heavy Forwarder)&lt;/P&gt;</description>
      <pubDate>Wed, 03 Oct 2018 08:15:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396981#M94104</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-10-03T08:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: Change sourcetype via field extraction and transforms</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396982#M94105</link>
      <description>&lt;P&gt;it didn't work&lt;/P&gt;

&lt;P&gt;When I use regex below, it works and index everything in the dest sourcetype but adding a pattern inside the capturing group breaks it &lt;BR /&gt;
    REGEX= (.*)&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 07:45:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396982#M94105</guid>
      <dc:creator>niboucher</dc:creator>
      <dc:date>2018-10-04T07:45:23Z</dc:date>
    </item>
    <item>
      <title>Re: Change sourcetype via field extraction and transforms</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396983#M94106</link>
      <description>&lt;P&gt;I have ingested below data in my lab environment with below config and it is working fine (Splunk version 7.1.2)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[A][B] blabla
[A][C] blabla
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;props.conf (In below config I have given &lt;CODE&gt;DATETIME_CONFIG = CURRENT&lt;/CODE&gt; because in sample data we don't have any timestamp)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[testData]
TRANSFORMS-testProp = testData_trans
SHOULD_LINEMERGE = False
DATETIME_CONFIG = CURRENT
NO_BINARY_CHECK = true
disabled = false
pulldown_type = true
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;transforms.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[testData_trans]
DEST_KEY = MetaData:Sourcetype
REGEX = \[A\]\[B\]
FORMAT = sourcetype::testData_B
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;With above config &lt;CODE&gt;[A][B] blabla&lt;/CODE&gt; line indexed with sourcetype &lt;CODE&gt;testData_B&lt;/CODE&gt; and &lt;CODE&gt;[A][C] blabla&lt;/CODE&gt; line indexed with sourcetype &lt;CODE&gt;testData&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 08:48:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396983#M94106</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-10-04T08:48:26Z</dc:date>
    </item>
    <item>
      <title>Re: Change sourcetype via field extraction and transforms</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396984#M94107</link>
      <description>&lt;P&gt;Thanks a lot man!&lt;BR /&gt;
The problem was certainly caused by the lack of timestamp. &lt;BR /&gt;
Setting it to CURRENT and using the regex you provided made it work.&lt;/P&gt;

&lt;P&gt;Niboucher&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 16:59:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396984#M94107</guid>
      <dc:creator>niboucher</dc:creator>
      <dc:date>2018-10-04T16:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Change sourcetype via field extraction and transforms</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396985#M94108</link>
      <description>&lt;P&gt;Great that it worked, &lt;CODE&gt;DATETIME_CONFIG = CURRENT&lt;/CODE&gt; assigns timestamp from splunk server itself, which means when data indexed whatever time present on splunk server that time will be assigned to events.&lt;/P&gt;

&lt;P&gt;I have converted my comment to answers, so that you can accept &amp;amp; upvote it.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 18:24:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Change-sourcetype-via-field-extraction-and-transforms/m-p/396985#M94108</guid>
      <dc:creator>harsmarvania57</dc:creator>
      <dc:date>2018-10-04T18:24:02Z</dc:date>
    </item>
  </channel>
</rss>

