<?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 How do I get the percentage of events in a logging file in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-the-percentage-of-events-in-a-logging-file/m-p/278662#M84156</link>
    <description>&lt;P&gt;Hello -&lt;/P&gt;

&lt;P&gt;I have a log file were ALL responses contain &lt;CODE&gt;[Thread-645990]&lt;/CODE&gt; (note, the number changes for each response).  In some of the responses we get a &lt;CODE&gt;AAA*Y**42&lt;/CODE&gt;  buried in the data. I want to get the percentage of &lt;CODE&gt;AAA*Y**42&lt;/CODE&gt; in comparison to all the &lt;CODE&gt;[Thread-######]&lt;/CODE&gt;. &lt;/P&gt;

&lt;P&gt;Thanks in advance for the help.&lt;/P&gt;</description>
    <pubDate>Fri, 22 Jul 2016 13:44:44 GMT</pubDate>
    <dc:creator>cj039165</dc:creator>
    <dc:date>2016-07-22T13:44:44Z</dc:date>
    <item>
      <title>How do I get the percentage of events in a logging file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-the-percentage-of-events-in-a-logging-file/m-p/278662#M84156</link>
      <description>&lt;P&gt;Hello -&lt;/P&gt;

&lt;P&gt;I have a log file were ALL responses contain &lt;CODE&gt;[Thread-645990]&lt;/CODE&gt; (note, the number changes for each response).  In some of the responses we get a &lt;CODE&gt;AAA*Y**42&lt;/CODE&gt;  buried in the data. I want to get the percentage of &lt;CODE&gt;AAA*Y**42&lt;/CODE&gt; in comparison to all the &lt;CODE&gt;[Thread-######]&lt;/CODE&gt;. &lt;/P&gt;

&lt;P&gt;Thanks in advance for the help.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2016 13:44:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-the-percentage-of-events-in-a-logging-file/m-p/278662#M84156</guid>
      <dc:creator>cj039165</dc:creator>
      <dc:date>2016-07-22T13:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the percentage of events in a logging file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-the-percentage-of-events-in-a-logging-file/m-p/278663#M84157</link>
      <description>&lt;P&gt;Try like this (assuming ThreadId is extracted)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | eval AAAY42=if(match(_raw,"AAA*Y*42"),1,0) | stats count as Total sum(AAAY42) as AAAY42 by ThreadId | eval Perc=round(AAAY42*100/Total,2)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Update&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Per below comment&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  your base search | eval AAAY42=if(match(_raw,"AAA*Y*42"),1,0) | stats count as Total sum(AAAY42) as AAAY42  | eval Percentage_AAAY42=round(AAAY42*100/Total,2) | table Total Percentage_AAAY42
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Jul 2016 18:36:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-the-percentage-of-events-in-a-logging-file/m-p/278663#M84157</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-07-22T18:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the percentage of events in a logging file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-the-percentage-of-events-in-a-logging-file/m-p/278664#M84158</link>
      <description>&lt;P&gt;Hello -&lt;/P&gt;

&lt;P&gt;This is getting me closer. This search shows 4 columns,  thread, total, AAA42 and Perc.  I trying to get two counts. First is the total number for 'thread-###'  the second is the percentage of that count that are AAA*Y**42. &lt;/P&gt;

&lt;P&gt;So one column would be Total number of responses (this is the thread count) the second column would be % of AAA_42. &lt;/P&gt;

&lt;P&gt;Sorry if I was confusing in my question. Thanks for the help.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:21:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-the-percentage-of-events-in-a-logging-file/m-p/278664#M84158</guid>
      <dc:creator>cj039165</dc:creator>
      <dc:date>2020-09-29T10:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the percentage of events in a logging file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-the-percentage-of-events-in-a-logging-file/m-p/278665#M84159</link>
      <description>&lt;P&gt;Try the updated answer.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2016 19:15:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-the-percentage-of-events-in-a-logging-file/m-p/278665#M84159</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-07-22T19:15:58Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the percentage of events in a logging file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-the-percentage-of-events-in-a-logging-file/m-p/278666#M84160</link>
      <description>&lt;P&gt;Good morning. &lt;/P&gt;

&lt;P&gt;Interesting results in search. I ran your updated search, it shows 0% for AAA count. If I remove the 42 (AAA*Y*) I get the 35% count I would expect. Not sure why the 42 is causing an issue. AAA*Y* is good, give me a count for all the AAA responses. I'm wondering how to create a more granular search? How would I look for AAA*Y*&lt;EM&gt;72*C or AAA*Y&lt;/EM&gt;*71*R.   Thanks again. &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:21:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-the-percentage-of-events-in-a-logging-file/m-p/278666#M84160</guid>
      <dc:creator>cj039165</dc:creator>
      <dc:date>2020-09-29T10:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the percentage of events in a logging file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-the-percentage-of-events-in-a-logging-file/m-p/278667#M84161</link>
      <description>&lt;P&gt;Think I have it. I changed (_raw,"AAA*Y*42"),1,0) to (_raw, "AAA*Y**42*").  Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 10:21:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-the-percentage-of-events-in-a-logging-file/m-p/278667#M84161</guid>
      <dc:creator>cj039165</dc:creator>
      <dc:date>2020-09-29T10:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the percentage of events in a logging file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-the-percentage-of-events-in-a-logging-file/m-p/278668#M84162</link>
      <description>&lt;P&gt;Hello -&lt;/P&gt;

&lt;P&gt;I noticed a problem with the search results. Turns out the 'thread-id' value can show up on different servers. So I need to calculate response time for the same files on three different servers. &lt;/P&gt;

&lt;P&gt;Meaning look in &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/hdx2/was70-32/AppServer/profiles/AppSrv01/logs/PRD2_PY0/TNBC_Receive.log
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/hdx2/was70-32/AppServer/profiles/AppSrv01/logs/PRD2_PY0/TNBC_Send.log 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;on three different servers. However match the thread-ids on a server by server bases. &lt;/P&gt;

&lt;P&gt;Thread-id 111111 on server WASAPP07 needs to be calculated separate from Thread-id 111111 on WASAPP08.&lt;/P&gt;

&lt;P&gt;Here is the search I'm using now:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=hdx_payer source="/hdx2/was70-32/AppServer/profiles/AppSrv01/logs/PRD2_PY0/TNBC_Receive.log" OR source="/hdx2/was70-32/AppServer/profiles/AppSrv01/logs/PRD2_PY0/TNBC_Send.log" | eval Time=_time | stats values(Time) as Time by thread_id | where mvcount(Time)=2 | eval response_time=tonumber(mvindex(Time,1))-tonumber(mvindex(Time,0)) | convert ctime(Time)
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Jul 2016 13:52:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-the-percentage-of-events-in-a-logging-file/m-p/278668#M84162</guid>
      <dc:creator>cj039165</dc:creator>
      <dc:date>2016-07-26T13:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the percentage of events in a logging file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-the-percentage-of-events-in-a-logging-file/m-p/278669#M84163</link>
      <description>&lt;P&gt;Glad you found a solution with help from @somesoni2. Please don't forget to resolve the post (and all your other questions) by clicking "Accept" directly below the answer. Also, be sure to upvote any answers and/or comments that were especially helpful.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 19:07:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-the-percentage-of-events-in-a-logging-file/m-p/278669#M84163</guid>
      <dc:creator>ppablo</dc:creator>
      <dc:date>2016-07-27T19:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the percentage of events in a logging file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-the-percentage-of-events-in-a-logging-file/m-p/278670#M84164</link>
      <description>&lt;P&gt;Ah sorry, I just saw your most recent comment in the thread above. I hope you get it sorted it out soon! but once you do, then follow up with my comments above. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 19:09:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-get-the-percentage-of-events-in-a-logging-file/m-p/278670#M84164</guid>
      <dc:creator>ppablo</dc:creator>
      <dc:date>2016-07-27T19:09:28Z</dc:date>
    </item>
  </channel>
</rss>

