<?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: Dynamic Sourcetype Extraction based in stanza in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Dynamic-Sourcetype-Extraction-based-in-stanza/m-p/517135#M145389</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214482"&gt;@gauravmsharma&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I think you need to read up on what a sourcetype is in Splunk and how it is used and should be used.&amp;nbsp; It will not help you here and is confusing when used in the context of this question.&lt;/P&gt;&lt;P&gt;So for your question&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;So the query remains can be use this initializing line for creating a sourcetype and assign logs to the same sourcetype till it recived a message Killed in the events.&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;The answer is no.&lt;BR /&gt;&lt;BR /&gt;From what I can tell you are trying to tie individual events in a log file together, but these individual events have no unique key value to tie then together.&lt;BR /&gt;&lt;BR /&gt;Depending on the log content and the order of events in the log, you &lt;U&gt;may&lt;/U&gt; be able to tie the individual events together using the Splunk processing language (SPL) with commands like transaction and stats.&amp;nbsp; &amp;nbsp;Without a good look at the source log data it hard to know though.&amp;nbsp; If you attach some to this question then may be able to help.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 31 Aug 2020 23:00:02 GMT</pubDate>
    <dc:creator>yeahnah</dc:creator>
    <dc:date>2020-08-31T23:00:02Z</dc:date>
    <item>
      <title>Dynamic Sourcetype Extraction based in stanza</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamic-Sourcetype-Extraction-based-in-stanza/m-p/516953#M145323</link>
      <description>&lt;P&gt;Need some suggestions related to dynamic sourcetype extraction:&lt;/P&gt;&lt;P&gt;&amp;nbsp;Does splunk supports sourctype extraction from the stanza which i am using in monitor of inputs.conf file.&amp;nbsp; For ex:&lt;/P&gt;&lt;P&gt;/var/log/test-function_name.log&lt;/P&gt;&lt;P&gt;In this log i want to extract the function-name and use it as a source type. This also means there will be multiple log files under /var/log folder based on function_name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The reason why i am using this is because my log events does not include this fuction name is each and evert event .&lt;/P&gt;&lt;P&gt;The events are more specifially comming in like:&lt;/P&gt;&lt;P&gt;""&lt;/P&gt;&lt;P&gt;Log forwarding initializing for function =test/function-name&lt;/P&gt;&lt;P&gt;job_id: XX created&lt;/P&gt;&lt;P&gt;----------------Logs-----------------&lt;/P&gt;&lt;P&gt;jo_id: XX killed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So what is the best way to extract the function_name.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2020 05:52:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamic-Sourcetype-Extraction-based-in-stanza/m-p/516953#M145323</guid>
      <dc:creator>gauravmsharma</dc:creator>
      <dc:date>2020-08-31T05:52:06Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Sourcetype Extraction based in stanza</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamic-Sourcetype-Extraction-based-in-stanza/m-p/516960#M145329</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214482"&gt;@gauravmsharma&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not exactly sure what you're asking for here but I'll give an answer a go.&amp;nbsp; At least it might lead to some better understanding.&lt;BR /&gt;&lt;BR /&gt;I don't believe&amp;nbsp;"dynamic sourcetype extraction based on the stanza" entry is something that can be done, or even should be done, if it was even possible in Splunk.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;sourcetype&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;determines how Splunk software processes the incoming data stream into individual events according to the nature of the data (ref:&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Data/Aboutdefaultfields#Source_vs_sourcetype" target="_blank" rel="noopener"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Data/Aboutdefaultfields#Source_vs_sourcetype&lt;/A&gt;).&amp;nbsp; It a useful way of grouping similar data sources based on their data format/syntax/structure.&amp;nbsp; &amp;nbsp;If you could do this then you would also, potentially, have to configure lots of sourcetype entries to tell Splunk how to process the incoming data into events .&lt;BR /&gt;&lt;BR /&gt;It does not really matter anyway as you also have the &lt;STRONG&gt;source&lt;/STRONG&gt;&amp;nbsp;metadata field, which already contains the function-name (as you call it) in the monitor stanza.&amp;nbsp; You can extract/manipulate it for every event when you search it.&lt;/P&gt;&lt;P&gt;For example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;# inputs.conf
[monitor:///var/log/test-function_name.log]
sourcetype = some_sourcetype&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Events found in this file would all be assigned with&amp;nbsp;&lt;STRONG&gt;source="/var/log/test-function_name.log"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Now you can use regex or eval functions in the Splunk search language to extract the function_name from the source field's value, e.g.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;... my base search ...
| rex field=source "\/(?&amp;lt;func_name&amp;gt;)[^\.]+)"
...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Resulting in all events in the inputs file having a new key value pair of func_name="test-function_name" .&amp;nbsp; This could also be automated in Splunk's&amp;nbsp; field extractions so it just happens automatically without specifying it in the search query,&lt;/P&gt;&lt;P&gt;Note, I'm just using examples above to show what could be done and you will need to adjust for your own needs.&lt;BR /&gt;&lt;BR /&gt;Hope this helps or gives you some ideas.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2020 07:35:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamic-Sourcetype-Extraction-based-in-stanza/m-p/516960#M145329</guid>
      <dc:creator>yeahnah</dc:creator>
      <dc:date>2020-08-31T07:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Sourcetype Extraction based in stanza</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamic-Sourcetype-Extraction-based-in-stanza/m-p/516992#M145343</link>
      <description>&lt;P&gt;I guess that is the problem with the events which i am trying to parse. Not every event include this function_name which makes it difficult to dynamically asign the source type. In my case the the events starts which a message&lt;/P&gt;&lt;P&gt;2020-08-31T05:27:58 : Log forwarding initializing for job=job::/test/function-name&amp;nbsp;&lt;/P&gt;&lt;P&gt;It ends with&amp;nbsp;&lt;/P&gt;&lt;P&gt;2020-08-31T05:28: job.id: XX Killed&lt;/P&gt;&lt;P&gt;In between there are logs which has no reference for this so called function-name&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the query remains can be use this initializing line for creating a sourcetype and assign logs to the same sourcetype till it recived a message Killed in the events.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or will process each and every event based on the conf files props.conf and tranform.conf.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since in this case i am using func_name as a variable and it can comeup with multiple values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2020 10:24:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamic-Sourcetype-Extraction-based-in-stanza/m-p/516992#M145343</guid>
      <dc:creator>gauravmsharma</dc:creator>
      <dc:date>2020-08-31T10:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Sourcetype Extraction based in stanza</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamic-Sourcetype-Extraction-based-in-stanza/m-p/517135#M145389</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/214482"&gt;@gauravmsharma&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I think you need to read up on what a sourcetype is in Splunk and how it is used and should be used.&amp;nbsp; It will not help you here and is confusing when used in the context of this question.&lt;/P&gt;&lt;P&gt;So for your question&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;So the query remains can be use this initializing line for creating a sourcetype and assign logs to the same sourcetype till it recived a message Killed in the events.&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;The answer is no.&lt;BR /&gt;&lt;BR /&gt;From what I can tell you are trying to tie individual events in a log file together, but these individual events have no unique key value to tie then together.&lt;BR /&gt;&lt;BR /&gt;Depending on the log content and the order of events in the log, you &lt;U&gt;may&lt;/U&gt; be able to tie the individual events together using the Splunk processing language (SPL) with commands like transaction and stats.&amp;nbsp; &amp;nbsp;Without a good look at the source log data it hard to know though.&amp;nbsp; If you attach some to this question then may be able to help.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Aug 2020 23:00:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamic-Sourcetype-Extraction-based-in-stanza/m-p/517135#M145389</guid>
      <dc:creator>yeahnah</dc:creator>
      <dc:date>2020-08-31T23:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic Sourcetype Extraction based in stanza</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dynamic-Sourcetype-Extraction-based-in-stanza/m-p/517672#M145584</link>
      <description>&lt;P&gt;I guess i found what i was looking for:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.splunk.com/t5/Getting-Data-In/dynamically-assign-sourcetype-on-folder/td-p/281104" target="_blank"&gt;https://community.splunk.com/t5/Getting-Data-In/dynamically-assign-sourcetype-on-folder/td-p/281104&lt;/A&gt;&lt;/P&gt;&lt;P&gt;So this is what i tested and it's working like a charm till now &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Sep 2020 08:52:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dynamic-Sourcetype-Extraction-based-in-stanza/m-p/517672#M145584</guid>
      <dc:creator>gauravmsharma</dc:creator>
      <dc:date>2020-09-03T08:52:30Z</dc:date>
    </item>
  </channel>
</rss>

