<?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: Can I use regex to assign a sourcetype? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-regex-to-assign-a-sourcetype/m-p/356376#M105461</link>
    <description>&lt;P&gt;Please find the regex " (?ms).&lt;EM&gt;to(?.&lt;/EM&gt;)" for the example you provided "This log belong to ABC"&lt;BR /&gt;
similarly you have to proceed using the online tool &lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt; &lt;/P&gt;</description>
    <pubDate>Mon, 19 Mar 2018 11:48:25 GMT</pubDate>
    <dc:creator>logloganathan</dc:creator>
    <dc:date>2018-03-19T11:48:25Z</dc:date>
    <item>
      <title>Can I use regex to assign a sourcetype?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-regex-to-assign-a-sourcetype/m-p/356373#M105458</link>
      <description>&lt;P&gt;Hello. I new to regex and have been trying to understand how it works. &lt;/P&gt;

&lt;P&gt;Let say i have a log containing strings of information. I am to index it to splunk and assign a sourcetype to it via props.conf and transform.conf. Am i suppose to use regex to match a string, and if match, proceed to assign sourcetype?&lt;/P&gt;

&lt;P&gt;1- Example, log contents as following:&lt;BR /&gt;
"This log belong to ABC"&lt;/P&gt;

&lt;P&gt;2 - In transforms.conf:&lt;BR /&gt;
[assign_sourcetype]&lt;BR /&gt;
DEST_KEY = MetaData:Sourcetype&lt;BR /&gt;
REGEX = (ABC|ABC)&lt;BR /&gt;
FORMAT = sourcetype::ABC&lt;/P&gt;

&lt;P&gt;Anyway, the above regex does not work. Any help much appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:55:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-regex-to-assign-a-sourcetype/m-p/356373#M105458</guid>
      <dc:creator>linwqg</dc:creator>
      <dc:date>2020-09-29T15:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use regex to assign a sourcetype?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-regex-to-assign-a-sourcetype/m-p/356374#M105459</link>
      <description>&lt;P&gt;Hi linwqg,&lt;BR /&gt;
if you're new to regex, you could follow two ways: &lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;use the Splunk Extraction field web interface,&lt;/LI&gt;
&lt;LI&gt;put your example in regex101.com and find the correct regex using this test url.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;Anyway, I'm not sure that you can assign a sourcetype using a regex, because sourcetype is a field that identify a data flow and all the following knowledge objects (fields, eventtypes, ...) are related to sourcetype, so if you have dynamic sourcetype,s how your knowledge Objects can follow sourcetypes?&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 10:01:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-regex-to-assign-a-sourcetype/m-p/356374#M105459</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-09-25T10:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use regex to assign a sourcetype?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-regex-to-assign-a-sourcetype/m-p/356375#M105460</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;You specify the sourcetype at input time(it will be more efficient) in inputs.conf..&lt;/P&gt;

&lt;P&gt;So you would have your monitor stanza [monitor this file] under that you put sourcetype = mysourcetype.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/SplunkCloud/6.6.1/Data/Monitorfilesanddirectorieswithinputs.conf"&gt;http://docs.splunk.com/Documentation/SplunkCloud/6.6.1/Data/Monitorfilesanddirectorieswithinputs.conf&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;There is no need for regex unless you are trying to extract multiple sourcetypes from a single log or something like that&lt;/P&gt;</description>
      <pubDate>Mon, 25 Sep 2017 10:14:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-regex-to-assign-a-sourcetype/m-p/356375#M105460</guid>
      <dc:creator>mwdbhyat</dc:creator>
      <dc:date>2017-09-25T10:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use regex to assign a sourcetype?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-regex-to-assign-a-sourcetype/m-p/356376#M105461</link>
      <description>&lt;P&gt;Please find the regex " (?ms).&lt;EM&gt;to(?.&lt;/EM&gt;)" for the example you provided "This log belong to ABC"&lt;BR /&gt;
similarly you have to proceed using the online tool &lt;A href="https://regex101.com/"&gt;https://regex101.com/&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 11:48:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-regex-to-assign-a-sourcetype/m-p/356376#M105461</guid>
      <dc:creator>logloganathan</dc:creator>
      <dc:date>2018-03-19T11:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use regex to assign a sourcetype?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-regex-to-assign-a-sourcetype/m-p/356377#M105462</link>
      <description>&lt;P&gt;any update? is this helpful?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 15:49:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-regex-to-assign-a-sourcetype/m-p/356377#M105462</guid>
      <dc:creator>logloganathan</dc:creator>
      <dc:date>2018-03-19T15:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use regex to assign a sourcetype?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Can-I-use-regex-to-assign-a-sourcetype/m-p/356378#M105463</link>
      <description>&lt;P&gt;Do NOT do it this way. I've seen many environments where they create sourcetypes willy-nilly and wonder why it takes forever to onboard data. Every time you create a unique sourcetype, you need to write base configs which tell the indexers how to break the events and how to read the timestamp. The best approach is to use the least amount of sourcetypes and have a standard sourcetype for each data format. Then use eventtypes to differentiate between apps and environments like you were with sourcetypes &lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 16:30:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Can-I-use-regex-to-assign-a-sourcetype/m-p/356378#M105463</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2018-03-19T16:30:39Z</dc:date>
    </item>
  </channel>
</rss>

