<?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: I have block of 10 lines. What is the splunk command to get only 3 line where line starts from keyword ERROR? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596070#M207498</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/245396"&gt;@anitha123gnana&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you could try to:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;group events to filter them,&lt;/LI&gt;&lt;LI&gt;ungroup them to have again separate events (but already filtered&lt;/LI&gt;&lt;LI&gt;to group them again.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=my_index   sourcetype="debugLog" (ERROR OR DEBUG)
| transaction Threadnumber startswith="User job started" endswith="User job ended"
| eval myRaw = _raw
| mvexpand myRaw 
| rename myRaw as _raw
| transaction startswith="ERROR" maxevents=4&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
    <pubDate>Sun, 01 May 2022 14:39:34 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2022-05-01T14:39:34Z</dc:date>
    <item>
      <title>With 10 blocks of lines, what is the Splunk command to get only 3 line where line starts from keyword ERROR?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596028#M207487</link>
      <description>&lt;P&gt;Block:&lt;/P&gt;
&lt;P&gt;2022-02-14 02:30:00,046 [Worker-3] DEBUG User job started&lt;BR /&gt;2022-02-14 02:30:00,063 [Worker-3] DEBUG Calling importData&lt;BR /&gt;2022-02-14 02:30:00,063 [Worker-3] DEBUG Initializing External DB connection&lt;BR /&gt;2022-02-14 02:30:00,063 [Worker-3] ERROR Exception occured&lt;BR /&gt;2022-02-14 02:30:00,067 [Worker-3] DEBUG url before binding&lt;BR /&gt;2022-02-14 02:30:00,560 [Worker-3] DEBUG inside finally...&lt;BR /&gt;2022-02-14 02:30:00,567 [Worker-3] DEBUG sending Notification Email&lt;BR /&gt;2022-02-14 02:30:00,567 [Worker-3] DEBUG User job ended&lt;BR /&gt;2022-02-14 02:30:00,046 [Worker-3] DEBUG User job started&lt;BR /&gt;2022-02-14 02:30:00,063 [Worker-3] DEBUG Calling importData&lt;BR /&gt;2022-02-14 02:30:00,063 [Worker-3] DEBUG Initializing External DB connection&lt;BR /&gt;2022-02-14 02:30:00,067 [Worker-3] DEBUG url before binding&lt;BR /&gt;2022-02-14 02:30:00,560 [Worker-3] DEBUG inside finally...&lt;BR /&gt;2022-02-14 02:30:00,567 [Worker-3] DEBUG sending Notification Email&lt;BR /&gt;2022-02-14 02:30:00,567 [Worker-3] DEBUG User job ended&lt;/P&gt;
&lt;P&gt;Expected output:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2022-02-14 02:30:00,063 [Worker-3] ERROR Exception occured&lt;BR /&gt;&lt;SPAN&gt;2022-02-14 02:30:00,067 [Worker-3] DEBUG url before binding&lt;BR /&gt;&lt;SPAN&gt;2022-02-14 02:30:00,560 [Worker-3] DEBUG inside finally...&lt;BR /&gt;&lt;SPAN&gt;2022-02-14 02:30:00,567 [Worker-3] DEBUG sending Notification Email&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Sat, 30 Apr 2022 20:10:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596028#M207487</guid>
      <dc:creator>anitha123gnana</dc:creator>
      <dc:date>2022-04-30T20:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: I have block of 10 lines. What is the splunk command to get only 3 line where line starts from keyword ERROR?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596035#M207488</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/245396"&gt;@anitha123gnana&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;this is one of the few situations in which using transaction command (&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.6/SearchReference/Transaction" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.6/SearchReference/Transaction&lt;/A&gt;),&lt;/P&gt;&lt;P&gt;Please try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=your_index (ERROR OR DEBUG)
| transaction startswith="ERROR" maxevents=4&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Sat, 30 Apr 2022 09:36:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596035#M207488</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-04-30T09:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: I have block of 10 lines. What is the splunk command to get only 3 line where line starts from keyword ERROR?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596046#M207490</link>
      <description>&lt;P&gt;Thank you for the quick reply.&lt;/P&gt;&lt;P&gt;But, the block of 10 lines is the result of the below query.&lt;/P&gt;&lt;P&gt;index=my_index&amp;nbsp; &amp;nbsp;sourcetype="debugLog" | transaction Threadnumber startswith="User job started" endswith="User job ended"&lt;/P&gt;&lt;P&gt;&amp;nbsp;Threadnumber -&amp;gt;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;[Worker-3]&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How do I add logic to this query so that only error messages are extracted from this block?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 May 2022 03:40:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596046#M207490</guid>
      <dc:creator>anitha123gnana</dc:creator>
      <dc:date>2022-05-01T03:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: I have block of 10 lines. What is the splunk command to get only 3 line where line starts from keyword ERROR?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596070#M207498</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/245396"&gt;@anitha123gnana&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you could try to:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;group events to filter them,&lt;/LI&gt;&lt;LI&gt;ungroup them to have again separate events (but already filtered&lt;/LI&gt;&lt;LI&gt;to group them again.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=my_index   sourcetype="debugLog" (ERROR OR DEBUG)
| transaction Threadnumber startswith="User job started" endswith="User job ended"
| eval myRaw = _raw
| mvexpand myRaw 
| rename myRaw as _raw
| transaction startswith="ERROR" maxevents=4&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Sun, 01 May 2022 14:39:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596070#M207498</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-05-01T14:39:34Z</dc:date>
    </item>
    <item>
      <title>Re: I have block of 10 lines. What is the splunk command to get only 3 line where line starts from keyword ERROR?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596098#M207502</link>
      <description>&lt;P&gt;I'm getting the below output for the query that you have given.&lt;/P&gt;&lt;P&gt;2022-02-14 02:30:00,046 [Worker-3] DEBUG User job started&lt;/P&gt;&lt;P&gt;2022-02-14 02:30:00,063 [Worker-3] DEBUG Calling importData&lt;/P&gt;&lt;P&gt;2022-02-14 02:30:00,063 [Worker-3] DEBUG Initializing External DB connection&lt;/P&gt;&lt;P&gt;2022-02-14 02:30:00,063 [Worker-3] ERROR Exception occured&lt;/P&gt;&lt;P&gt;2022-02-14 02:30:00,063 [Worker-3] DEBUG Calling importData&lt;/P&gt;&lt;P&gt;2022-02-14 02:30:00,063 [Worker-3] DEBUG Initializing External DB connection&lt;/P&gt;&lt;P&gt;2022-02-14 02:30:00,067 [Worker-3] DEBUG url before binding&lt;/P&gt;&lt;P&gt;2022-02-14 02:30:00,067 [Worker-3] DEBUG url before binding&lt;/P&gt;&lt;P&gt;2022-02-14 02:30:00,560 [Worker-3] DEBUG inside finally...&lt;/P&gt;&lt;P&gt;2022-02-14 02:30:00,560 [Worker-3] DEBUG inside finally...&lt;/P&gt;&lt;P&gt;2022-02-14 02:30:00,567 [Worker-3] DEBUG sending Notification Email&lt;/P&gt;&lt;P&gt;2022-02-14 02:30:00,567 [Worker-3] DEBUG User job ended&lt;/P&gt;&lt;P&gt;But, the expected output is only the error message from that transaction.&lt;/P&gt;&lt;P&gt;2022-02-14 02:30:00,063 [Worker-3] ERROR Exception occured&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 05:51:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596098#M207502</guid>
      <dc:creator>anitha123gnana</dc:creator>
      <dc:date>2022-05-02T05:51:30Z</dc:date>
    </item>
    <item>
      <title>Re: I have block of 10 lines. What is the splunk command to get only 3 line where line starts from keyword ERROR?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596100#M207504</link>
      <description>&lt;P&gt;Just use your original search and search ERROR after the transaction and then filter out the multi-value event lines from the first errro&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=my_index   sourcetype="debugLog"
| transaction Threadnumber startswith="User job started" endswith="User job ended"
| search "ERROR"
| rex max_match=0 "(?&amp;lt;log&amp;gt;.*ERROR|DEBUG.*)"
| eval log=mvindex(log, mvfind(log, "ERROR"), -1)&lt;/LI-CODE&gt;&lt;P&gt;Might be another way - but this may work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 06:04:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596100#M207504</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-05-02T06:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: I have block of 10 lines. What is the splunk command to get only 3 line where line starts from keyword ERROR?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596101#M207505</link>
      <description>&lt;P&gt;I tried this query before but it is not working.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 06:06:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596101#M207505</guid>
      <dc:creator>anitha123gnana</dc:creator>
      <dc:date>2022-05-02T06:06:22Z</dc:date>
    </item>
    <item>
      <title>Re: I have block of 10 lines. What is the splunk command to get only 3 line where line starts from keyword ERROR?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596102#M207506</link>
      <description>&lt;P&gt;Sorry, I edited the query - not sure which one you tried.&lt;/P&gt;&lt;P&gt;The idea behind mvfind/mvindex is that the rex statement will break raw into a multi-value field called 'log' and then you are just selecting the subset of those events from the ERROR to the last entry.&lt;/P&gt;&lt;P&gt;What didn't work?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 06:08:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596102#M207506</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2022-05-02T06:08:43Z</dc:date>
    </item>
    <item>
      <title>Re: I have block of 10 lines. What is the splunk command to get only 3 line where line starts from keyword ERROR?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596110#M207513</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/245396"&gt;@anitha123gnana&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;let me understand, do you want:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;only one row with the ERROR string,&lt;/LI&gt;&lt;LI&gt;the ERROR row with the following three rows&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;?&lt;/P&gt;&lt;P&gt;if the second, my search should be correct (using maxevents=4 option).&lt;/P&gt;&lt;P&gt;If the first you don't need the transaction command.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 06:46:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596110#M207513</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-05-02T06:46:19Z</dc:date>
    </item>
    <item>
      <title>Re: I have block of 10 lines. What is the splunk command to get only 3 line where line starts from keyword ERROR?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596128#M207518</link>
      <description>&lt;P&gt;Sorry, Our expected result is&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;the ERROR row with the following three rows&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;But, the below query is returning the first transaction block as result . The second transaction command is not working.&lt;/P&gt;&lt;P&gt;index=my_index sourcetype="debugLog" (ERROR OR DEBUG)&lt;BR /&gt;| transaction Threadnumber startswith="User job started" endswith="User job ended"&lt;BR /&gt;| eval myRaw = _raw&lt;BR /&gt;| mvexpand myRaw&lt;BR /&gt;| rename myRaw as _raw&lt;BR /&gt;| transaction startswith="ERROR" maxevents=4&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 09:28:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596128#M207518</guid>
      <dc:creator>anitha123gnana</dc:creator>
      <dc:date>2022-05-02T09:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: I have block of 10 lines. What is the splunk command to get only 3 line where line starts from keyword ERROR?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596131#M207519</link>
      <description>&lt;P&gt;Our expected result is&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;the ERROR row with the following three rows&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Mon, 02 May 2022 10:09:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596131#M207519</guid>
      <dc:creator>anitha123gnana</dc:creator>
      <dc:date>2022-05-02T10:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: I have block of 10 lines. What is the splunk command to get only 3 line where line starts from keyword ERROR?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596139#M207520</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/245396"&gt;@anitha123gnana&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;what does it happen if you use the simple search&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=my_index   sourcetype="debugLog" (ERROR OR DEBUG)
| transaction startswith="ERROR" maxevents=4&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 11:07:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596139#M207520</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2022-05-02T11:07:06Z</dc:date>
    </item>
    <item>
      <title>Re: I have block of 10 lines. What is the splunk command to get only 3 line where line starts from keyword ERROR?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596141#M207521</link>
      <description>&lt;P&gt;Simple search does not work as we have many jobs running in multiple threads recorded in the log file. We are targeting a specific job in one thread and try to extract first 4 lines of its error messages.&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 12:24:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/With-10-blocks-of-lines-what-is-the-Splunk-command-to-get-only-3/m-p/596141#M207521</guid>
      <dc:creator>anitha123gnana</dc:creator>
      <dc:date>2022-05-02T12:24:10Z</dc:date>
    </item>
  </channel>
</rss>

