<?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 Splunk search logs in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Splunk-search-logs/m-p/132361#M36104</link>
    <description>&lt;P&gt;Am having log entries as per below. &lt;/P&gt;

&lt;P&gt;In essence, we have to detect a line with “Task started. Task id - 'number'  an save the number for task id.&lt;BR /&gt;
Then we have to detect another line with “Task completed. Task id - 'number' and the same number. &lt;/P&gt;

&lt;P&gt;'number' will be keep changing in logs, so we have to scann the 'number' and then alert if start or stop is failed. Can i have query which will meet the requirement. &lt;/P&gt;

&lt;P&gt;If we find those two lines without any error logs in between, then we are good. If there are ERROR logs in between then we have to raise an alarm.&lt;/P&gt;</description>
    <pubDate>Mon, 01 Jun 2015 10:25:05 GMT</pubDate>
    <dc:creator>ramanapvr</dc:creator>
    <dc:date>2015-06-01T10:25:05Z</dc:date>
    <item>
      <title>Splunk search logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-search-logs/m-p/132361#M36104</link>
      <description>&lt;P&gt;Am having log entries as per below. &lt;/P&gt;

&lt;P&gt;In essence, we have to detect a line with “Task started. Task id - 'number'  an save the number for task id.&lt;BR /&gt;
Then we have to detect another line with “Task completed. Task id - 'number' and the same number. &lt;/P&gt;

&lt;P&gt;'number' will be keep changing in logs, so we have to scann the 'number' and then alert if start or stop is failed. Can i have query which will meet the requirement. &lt;/P&gt;

&lt;P&gt;If we find those two lines without any error logs in between, then we are good. If there are ERROR logs in between then we have to raise an alarm.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2015 10:25:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-search-logs/m-p/132361#M36104</guid>
      <dc:creator>ramanapvr</dc:creator>
      <dc:date>2015-06-01T10:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk search logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Splunk-search-logs/m-p/132362#M36105</link>
      <description>&lt;P&gt;If you want something like your number for further use, you should &lt;A href="http://docs.splunk.com/Splexicon:Fieldextraction"&gt;extract&lt;/A&gt; it as a field. If this is a sporadic need, you may want to do a search with the &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/SearchReference/Rex"&gt;command rex&lt;/A&gt; in it, which should look something like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your search so far | rex "Task id - '(?&amp;lt;number&amp;gt;\d+)'" | table number
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(provided the single quotes around number are present in your logs, if not remove them from the command). That will enable you to use a field with the name "number" just like any other field such as &lt;CODE&gt;host&lt;/CODE&gt; or &lt;CODE&gt;sourcetype&lt;/CODE&gt;, as I did with &lt;CODE&gt;table&lt;/CODE&gt; above.&lt;/P&gt;

&lt;P&gt;If this is needed more frequently, you may want to do this with automatic field extractions - simply use the same regular expression as above use Settings - Fields - Field Extractions. If you don't know what fields are, start &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/Knowledge/Aboutfields"&gt;here&lt;/A&gt;.&lt;/P&gt;

&lt;P&gt;Regarding how you from there get to what you need in the end, you might be interested in &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.2.3/SearchReference/Transaction"&gt;transaction&lt;/A&gt;. I'm thinking of something like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | transaction number startswith="Task started" endswith="Task completed"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and from there search for your error logs to raise alarms.&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jun 2015 11:11:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Splunk-search-logs/m-p/132362#M36105</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-06-01T11:11:39Z</dc:date>
    </item>
  </channel>
</rss>

