<?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: How to find correct logs to find error count. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-correct-logs-to-find-error-count/m-p/656579#M226775</link>
    <description>&lt;P&gt;The sample INFO event does not contain a "Received Payload" text.&lt;/P&gt;&lt;P&gt;What field(s) link the ERROR event to an INFO event?&lt;/P&gt;</description>
    <pubDate>Mon, 04 Sep 2023 18:26:32 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2023-09-04T18:26:32Z</dc:date>
    <item>
      <title>How to find correct logs to find error count.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-correct-logs-to-find-error-count/m-p/656573#M226772</link>
      <description>&lt;P&gt;I want to calculate the error count from the logs . But the error are of two times which can be distinguish only from the flow end event. i.e [ flow ended put :sync\C2V]&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="avi7326_0-1693840866045.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/27059i9C027C7D7B7C0D16/image-size/medium?v=v2&amp;amp;px=400" role="button" title="avi7326_0-1693840866045.png" alt="avi7326_0-1693840866045.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So what condition I can put so that I can get this information from the above given log.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;index=us_whcrm source=MuleUSAppLogs sourcetype= "bmw-crm-wh-xl-retail-amer-prd-api" ((severity=ERROR "Transatcion") OR (severity=INFO "Received Payload"))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am using this query to get below logs. Now I want a condition that when it is severity=error then I can get the severity= info event of received payload to get the details of the correlationId and also end flow event so that I can determine the error type.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="avi7326_1-1693840972534.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/27060iF0C01C4504B716D1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="avi7326_1-1693840972534.png" alt="avi7326_1-1693840972534.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="avi7326_2-1693841034345.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/27061i1054E35CA5F40B90/image-size/medium?v=v2&amp;amp;px=400" role="button" title="avi7326_2-1693841034345.png" alt="avi7326_2-1693841034345.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2023 15:33:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-correct-logs-to-find-error-count/m-p/656573#M226772</guid>
      <dc:creator>avi7326</dc:creator>
      <dc:date>2023-09-04T15:33:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to find correct logs to find error count.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-correct-logs-to-find-error-count/m-p/656579#M226775</link>
      <description>&lt;P&gt;The sample INFO event does not contain a "Received Payload" text.&lt;/P&gt;&lt;P&gt;What field(s) link the ERROR event to an INFO event?&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2023 18:26:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-correct-logs-to-find-error-count/m-p/656579#M226775</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2023-09-04T18:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to find correct logs to find error count.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-correct-logs-to-find-error-count/m-p/656586#M226779</link>
      <description>&lt;P&gt;It looks like you posted the same image twice, but I am assuming that in the INFO message was the first one at 11:15:54:355 and the error was 1 millisecond earlier at 11:15:54:354 and you want to extract the ID&amp;nbsp;&lt;STRONG&gt;&lt;SPAN class=""&gt;0021d100-46c2-11ee-9327-12b7e80d647b&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN class=""&gt;and then count those IDs which have only INFO and those that have both and error.&amp;nbsp; Or it might be that you just want to count errors vs info&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;so you could do&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval isInfo=if(severity="INFO", 1, 0)
| eval isError=if(severity="ERROR", 1, 0)
| stats sum(isInfo) as Transactions sum(isError) as Errors&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which would just count the INFO and ERROR events, or you could do this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rex field=message "(?&amp;lt;tx_id&amp;gt;\w{8}-\w{4}-\w{4}-\w{4}-\w{12})"
| stats count by tx_id
| where count=2&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which would give you all the transactions that ended in error, but it depends exactly what your output requirement and also whether you have more than one possible INFO/ERROR event in the dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Sep 2023 22:58:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-correct-logs-to-find-error-count/m-p/656586#M226779</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2023-09-04T22:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to find correct logs to find error count.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-correct-logs-to-find-error-count/m-p/656606#M226782</link>
      <description>&lt;P&gt;This is the received payload.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="avi7326_0-1693892320081.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/27062i25D25F8AB52E2DDC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="avi7326_0-1693892320081.png" alt="avi7326_0-1693892320081.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=us_whcrm source=MuleUSAppLogs sourcetype= "bmw-crm-wh-xl-retail-amer-prd-api" ((severity=ERROR "Transatcion") OR (severity=INFO "Received Payload"))
| rex field=message "(?&amp;lt;json_ext&amp;gt;\{[\w\W]*\})"
| table _time properties.correlationId json_ext
| spath input=json_ext
| rename  properties.correlationId as correlationId processRetailDeliveryReporting.processRetailDeliveryReportingDataArea.retailDeliveryReporting.retailDeliveryReportingVehicleLineItem.vehicle.vehicleID as VinId 
| eval BMWUnit=replace(BMWUnit,"([file://w%7b3%7d)(/w%7b2%7d]\\w{3})(\\w{2})", \\1-\\2)
| table _time correlationId BMWUnit dealerId Description VinId
| stats earliest(_time) as _time values(*) as * by correlationId
| where isnotnull(Description)&lt;/LI-CODE&gt;&lt;P class=""&gt;I am using this query to get all the errors and their field details in the table and it is working but now there is one condition that I have to differentiate that error they are of two types one we can get from the flow end event [sync/c2v] which I shared. And these errors I am calculating from description field.&lt;BR /&gt;what could I do chnage in my query to find the- error type.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 12:27:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-correct-logs-to-find-error-count/m-p/656606#M226782</guid>
      <dc:creator>avi7326</dc:creator>
      <dc:date>2023-09-05T12:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to find correct logs to find error count.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-correct-logs-to-find-error-count/m-p/656659#M226799</link>
      <description>&lt;P&gt;I want a condition like when it is severity=ERROR then show its received payload event and if it has sync/C2V event then it is COO error and if it does not have that then it is RDR error.Is there any way please help me in this.&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 05 Sep 2023 09:42:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-correct-logs-to-find-error-count/m-p/656659#M226799</guid>
      <dc:creator>avi7326</dc:creator>
      <dc:date>2023-09-05T09:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to find correct logs to find error count.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-find-correct-logs-to-find-error-count/m-p/656778#M226846</link>
      <description>&lt;P&gt;First, about data illustration.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Always use text illustration; when illustrating structure data such as JSON, always use raw text. &amp;nbsp;Screenshot is extremely difficult for volunteers to comprehend; they oftentimes also distort characteristics.&lt;/LI&gt;&lt;LI&gt;Always anonymize illustrated data. (One of your screenshots seems to contain information you do not want to divulge.)&lt;/LI&gt;&lt;LI&gt;Illustrate how you envision the output, use mockup.&lt;/LI&gt;&lt;LI&gt;Explain logic between illustrated data and desired output if it is not obvious. (It may be obvious to you but not to volunteers who are not intimately familiar with your data and use case.)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;This said, your later code suggests that&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;key information&amp;nbsp;"&lt;SPAN&gt;sync/c2v"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;is contained in the non-JSON part of "message". &amp;nbsp;You need to extract that first (I'll put it in &lt;U&gt;leadtext&lt;/U&gt;), then evaluate Description based on whether that information is present.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;there is a field&amp;nbsp;properties.correlationId that links ERROR event and INFO events, therefore transaction ID that is also contained in the non-JSON part of message is not needed. &amp;nbsp;Is this correct?&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;If these guesses are correct, you are looking for something like&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=us_whcrm source=MuleUSAppLogs sourcetype= "bmw-crm-wh-xl-retail-amer-prd-api" ((severity=ERROR "Transatcion") OR (severity=INFO "Received Payload"))
| rex field=message "(?&amp;lt;leadtext&amp;gt;[^{]+):\s*(?&amp;lt;payload&amp;gt;{.+})"
| eval Description = if(match(leadtext, "flow ended put:\\sync\\c2v"), "COO", "RDR")
| spath input=payload
| rename  properties.correlationId as correlationId processRetailDeliveryReporting.processRetailDeliveryReportingDataArea.retailDeliveryReporting.retailDeliveryReportingVehicleLineItem.vehicle.vehicleID as VinId 
| eval BMWUnit=replace(BMWUnit,"([file://w%7b3%7d)(/w%7b2%7d]\\w{3})(\\w{2})", "\\1-\\2")
| table _time correlationId BMWUnit dealerId Description VinId
| stats earliest(_time) as _time values(*) as * by correlationId
| where Description == "COO"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Hope this helps&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 07:35:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-find-correct-logs-to-find-error-count/m-p/656778#M226846</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-09-06T07:35:16Z</dc:date>
    </item>
  </channel>
</rss>

