<?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 use stats in multiple Condition and fields ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-in-multiple-Condition-and-fields/m-p/681533#M232884</link>
    <description>&lt;P&gt;It looks like you have an eval for ProcessMsg, immediately followed by a stats command which overwrites the same field - is this your issue?&lt;/P&gt;</description>
    <pubDate>Thu, 21 Mar 2024 11:58:40 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2024-03-21T11:58:40Z</dc:date>
    <item>
      <title>How to use stats in multiple Condition and fields ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-in-multiple-Condition-and-fields/m-p/681529#M232883</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;I am trying fetch details using stats.In this query I am trying get status from the below conditions and when i am populating in the table.The ProccesMsg&amp;nbsp; has some values but in failure conditions i will add message in the result so i used coalesec to map both the result and need to populate in the table.But i cant able to populate the result.What mistake i did here.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="mulesoft" applicationName="ext" environment=DEV   
               (*End of GL-import flow*)  OR (message="GLImport Job Already Running, Please wait for the job to complete*") OR (message="process - No files found for import to ISG") |rename content.File.fstatus as Status|eval Status=case( like('Status' ,"%SUCCESS%"),"SUCCESS",like('Status',"%ERROR%"),"ERROR",like('message',"%process - No files found for import to ISG%"), "ERROR",like('message',"GLImport Job Already Running, Please wait for the job to complete"), "WARN")
| eval ProcessMsg= coalesce(ProcessMsg,message)
|stats values(content.File.fid) as "TransferBatch/OnDemand" values(content.File.fname) as "BatchName/FileName"  values(content.File.fprocess_message) as ProcessMsg 
values(Status) as Status values(content.File.isg_file_batch_id) as OracleBatchID values(content.File.total_rec_count) as "Total Record Count" by correlationId
|table Status  Start_Time  "TransferBatch/OnDemand"  "BatchName/FileName"  ProcessMsg OracleBatchID "Total Record Count" ElapsedTimeInSecs "Total Elapsed Time" correlationId&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 11:50:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-in-multiple-Condition-and-fields/m-p/681529#M232883</guid>
      <dc:creator>karthi2809</dc:creator>
      <dc:date>2024-03-21T11:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use stats in multiple Condition and fields ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-in-multiple-Condition-and-fields/m-p/681533#M232884</link>
      <description>&lt;P&gt;It looks like you have an eval for ProcessMsg, immediately followed by a stats command which overwrites the same field - is this your issue?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2024 11:58:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-in-multiple-Condition-and-fields/m-p/681533#M232884</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-03-21T11:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to use stats in multiple Condition and fields ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-in-multiple-Condition-and-fields/m-p/681646#M232934</link>
      <description>&lt;P&gt;You need to clarify the problem in search result as well as explain/illustrate your raw data. &amp;nbsp;"Can't populate result" can have a million different meanings. &amp;nbsp;Do you mean to say that you get a completely blank table, i.e., no results at all? &amp;nbsp;If this is the case, you probably do not have a field named &lt;EM&gt;correlationId&lt;/EM&gt; in your raw data.&lt;/P&gt;&lt;P&gt;Or do you mean&amp;nbsp;&lt;FONT face="courier new,courier"&gt;values(content.File.fprocess_message) as ProcessMsg&lt;/FONT&gt; gives all null output? You cannot expect volunteers to read your mind. &amp;nbsp;Explain in no ambiguous terms.&lt;/P&gt;&lt;P&gt;You speak about ProessMsg but it is not obvious whether a field named "ProcessMsg" exists in raw data, despite a suggestion of that coalesce function. &amp;nbsp;Again, you cannot just ask volunteers to speculate from your code (aka mind-reading) what raw data look like.&lt;/P&gt;&lt;P&gt;Importantly, as &lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp; questioned, why go through all the trouble of coalescing if you are going to discard it, then use field name &lt;EM&gt;ProcessMsg&lt;/EM&gt; to store output of a stats function, as indicated in&amp;nbsp;&lt;FONT face="courier new,courier"&gt;values(content.File.fprocess_message) as ProcessMsg&lt;/FONT&gt;? &amp;nbsp;Most importantly, what is&amp;nbsp;&lt;EM&gt;content.File.fprocess_message&lt;/EM&gt;? Do you have evidence that this field even has value?&lt;/P&gt;&lt;P&gt;Do you really mean&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="mulesoft" applicationName="ext" environment=DEV   
               (*End of GL-import flow*)  OR (message="GLImport Job Already Running, Please wait for the job to complete*") OR (message="process - No files found for import to ISG")
|rename content.File.fstatus as Status
|eval Status=case( like('Status' ,"%SUCCESS%"),"SUCCESS",like('Status',"%ERROR%"),"ERROR",like('message',"%process - No files found for import to ISG%"), "ERROR",like('message',"GLImport Job Already Running, Please wait for the job to complete"), "WARN")
| eval ProcessMsg= coalesce(ProcessMsg,message)
|stats values(content.File.fid) as "TransferBatch/OnDemand" values(content.File.fname) as "BatchName/FileName"  values(ProcessMsg) as ProcessMsg 
values(Status) as Status values(content.File.isg_file_batch_id) as OracleBatchID values(content.File.total_rec_count) as "Total Record Count" by correlationId
|table Status  Start_Time  "TransferBatch/OnDemand"  "BatchName/FileName"  ProcessMsg OracleBatchID "Total Record Count" ElapsedTimeInSecs "Total Elapsed Time" correlationId&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2024 07:58:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-stats-in-multiple-Condition-and-fields/m-p/681646#M232934</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2024-03-22T07:58:10Z</dc:date>
    </item>
  </channel>
</rss>

