<?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: Cannot overwrite sourcetype and source from _raw in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Cannot-overwrite-sourcetype-and-source-from-raw/m-p/28936#M4980</link>
    <description>&lt;P&gt;Splunk is treating the data in _raw as one large string. Instead of using the "^" with the regexes, try using "\n", so:&lt;/P&gt;

&lt;P&gt;[setSourceType]&lt;BR /&gt;
SOURCE_KEY = __raw&lt;BR /&gt;&lt;BR /&gt;
DEST_KEY = MetaData:Sourcetype&lt;BR /&gt;&lt;BR /&gt;
REGEX = \nsourcetype=(.*)$&lt;BR /&gt;&lt;BR /&gt;
FORMAT = sourcetype::$1&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 09:40:53 GMT</pubDate>
    <dc:creator>dshpritz</dc:creator>
    <dc:date>2020-09-28T09:40:53Z</dc:date>
    <item>
      <title>Cannot overwrite sourcetype and source from _raw</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Cannot-overwrite-sourcetype-and-source-from-raw/m-p/28935#M4979</link>
      <description>&lt;P&gt;Hi All, &lt;/P&gt;

&lt;P&gt;I'm having a transforms.conf and props.conf override issue. &lt;/P&gt;

&lt;P&gt;inputs.conf:&lt;BR /&gt;&lt;BR /&gt;
[tcp://10000]&lt;BR /&gt;&lt;BR /&gt;
connection_host = dns&lt;BR /&gt;&lt;BR /&gt;
index = myindex&lt;BR /&gt;&lt;/P&gt;

&lt;P&gt;props.conf: &lt;BR /&gt;&lt;BR /&gt;
[source::tcp:10000]&lt;BR /&gt;&lt;BR /&gt;
MAX_EVENTS = 10000&lt;BR /&gt;&lt;BR /&gt;
TRUNCATE = 100000&lt;BR /&gt;&lt;BR /&gt;
BREAK_ONLY_BEFORE = ^host&lt;BR /&gt;&lt;BR /&gt;
TRANSFORMS-all=setHost, setSource, setSourceType&lt;BR /&gt;&lt;/P&gt;

&lt;P&gt;transforms.conf: &lt;BR /&gt;&lt;BR /&gt;
[setHost]&lt;BR /&gt;&lt;BR /&gt;
DEST_KEY = MetaData:Host&lt;BR /&gt;&lt;BR /&gt;
REGEX = ^host=([a-z0-9-]+)$&lt;BR /&gt;&lt;BR /&gt;
FORMAT = host::$1&lt;BR /&gt;&lt;/P&gt;

&lt;P&gt;[setSource]&lt;BR /&gt;&lt;BR /&gt;
SOURCE_KEY = _raw&lt;BR /&gt;&lt;BR /&gt;
DEST_KEY = MetaData:Source&lt;BR /&gt;&lt;BR /&gt;
REGEX = ^source=(.*)$&lt;BR /&gt;&lt;BR /&gt;
FORMAT = source::$1&lt;BR /&gt;&lt;/P&gt;

&lt;P&gt;[setSourceType]&lt;BR /&gt;&lt;BR /&gt;
SOURCE_KEY = _raw&lt;BR /&gt;&lt;BR /&gt;
DEST_KEY = MetaData:Sourcetype&lt;BR /&gt;&lt;BR /&gt;
REGEX = ^sourcetype=(.*)$&lt;BR /&gt;&lt;BR /&gt;
FORMAT = sourcetype::$1&lt;BR /&gt;&lt;/P&gt;

&lt;P&gt;So, the transformation setHost gets applied, but setSource and setSourceType doesnt. &lt;/P&gt;

&lt;P&gt;Any ideas? &lt;/P&gt;

&lt;P&gt;data is being sent via tcpsocket and a sample is like so: &lt;BR /&gt;&lt;BR /&gt;
host=test-devdb01&lt;BR /&gt;&lt;BR /&gt;
sourcetype=SESSIONS&lt;BR /&gt;&lt;BR /&gt;
source=myscript.sh&lt;BR /&gt;&lt;BR /&gt;
test-devdb01|itmscmd|SESSIONS|ACTIVE=1&lt;BR /&gt;&lt;BR /&gt;
test-devdb01|itmscmd|SESSIONS|ACTIVE=1&lt;BR /&gt;&lt;BR /&gt;
test-devdb01|itmscmd|SESSIONS|ACTIVE=1&lt;BR /&gt;&lt;BR /&gt;
test-devdb01|itmscmd|SESSIONS|ACTIVE=1&lt;BR /&gt;&lt;BR /&gt;
test-devdb01|itmscmd|SESSIONS|ACTIVE=1&lt;BR /&gt;&lt;BR /&gt;
test-devdb01|itmscmd|SESSIONS|ACTIVE=1&lt;BR /&gt;&lt;BR /&gt;
host=test-devdb01   Options|  sourcetype=tcp-raw   Options|  source=tcp:1567   Options&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:40:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Cannot-overwrite-sourcetype-and-source-from-raw/m-p/28935#M4979</guid>
      <dc:creator>seanwong</dc:creator>
      <dc:date>2020-09-28T09:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot overwrite sourcetype and source from _raw</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Cannot-overwrite-sourcetype-and-source-from-raw/m-p/28936#M4980</link>
      <description>&lt;P&gt;Splunk is treating the data in _raw as one large string. Instead of using the "^" with the regexes, try using "\n", so:&lt;/P&gt;

&lt;P&gt;[setSourceType]&lt;BR /&gt;
SOURCE_KEY = __raw&lt;BR /&gt;&lt;BR /&gt;
DEST_KEY = MetaData:Sourcetype&lt;BR /&gt;&lt;BR /&gt;
REGEX = \nsourcetype=(.*)$&lt;BR /&gt;&lt;BR /&gt;
FORMAT = sourcetype::$1&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:40:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Cannot-overwrite-sourcetype-and-source-from-raw/m-p/28936#M4980</guid>
      <dc:creator>dshpritz</dc:creator>
      <dc:date>2020-09-28T09:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot overwrite sourcetype and source from _raw</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Cannot-overwrite-sourcetype-and-source-from-raw/m-p/28937#M4981</link>
      <description>&lt;P&gt;With the explanation of it being treated as one large string, i then assumed splunk might treating it as a literal string '&lt;STRING&gt;'. &lt;BR /&gt;&lt;/STRING&gt;&lt;/P&gt;

&lt;P&gt;Just in case the greedy quantifier of * was eating too much, i also modified my regex to be:&lt;BR /&gt;&lt;BR /&gt;
REGEX = \nsource=([a-zA-Z0-9-.]+)&lt;BR /&gt;&lt;/P&gt;

&lt;P&gt;Thanks dshpritz!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2011 02:39:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Cannot-overwrite-sourcetype-and-source-from-raw/m-p/28937#M4981</guid>
      <dc:creator>seanwong</dc:creator>
      <dc:date>2011-06-16T02:39:36Z</dc:date>
    </item>
  </channel>
</rss>

