<?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 create eval to divide counts by auditType? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-eval-to-divide-counts-by-auditType/m-p/598289#M208333</link>
    <description>&lt;P&gt;Hi Somesoni&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've plugged that in but I get the following error (subbed audit type and session field)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Error in 'stats' command: The eval expression for dynamic field 'eval(if(auditType=TYPE1,SESSIONS,null()))' is invalid. Error='Typechecking failed. '-' only takes numbers.'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried replacing the null() with 0 instead to see if that kicked it in but no luck &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for replying &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 18 May 2022 10:50:08 GMT</pubDate>
    <dc:creator>Megz</dc:creator>
    <dc:date>2022-05-18T10:50:08Z</dc:date>
    <item>
      <title>How to create eval to divide counts by auditType?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-eval-to-divide-counts-by-auditType/m-p/598106#M208276</link>
      <description>&lt;P&gt;Hi - I am a relatively novice Splunk user.&lt;/P&gt;
&lt;P&gt;I am looking at implict vs explicit audit events and looking to do a calculation based on a count of these two events. I was trying to write an eval but wasn't getting anywhere&lt;/P&gt;
&lt;P&gt;This is my search (redacted)&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| multisearch
[| search auditSource=SOURCE auditType=TYPE 1 | regex tags.path=PATH ]
[| search auditSource=SOURCE auditType=TYPE2]
| stats dc(SESSIONS) as Total by auditType&lt;/LI-CODE&gt;
&lt;P&gt;So, now I have a count of the sessions in both audit types, where unique sessions in TYPE1 are journey starts, and unique sessions in TYPE2 are completions.&lt;/P&gt;
&lt;P&gt;I want to calculate the completion rate so essentially what I need is the distinct session count in TYPE1 divided by the distinct session count in TYPE2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;p.s. I should note the audit sources for both are the same, and there are no other unique fields I can use instead.&lt;/P&gt;</description>
      <pubDate>Tue, 17 May 2022 15:12:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-eval-to-divide-counts-by-auditType/m-p/598106#M208276</guid>
      <dc:creator>Megz</dc:creator>
      <dc:date>2022-05-17T15:12:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to create eval to divide counts by auditType?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-eval-to-divide-counts-by-auditType/m-p/598109#M208278</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| multisearch
[| search auditSource=SOURCE auditType=TYPE 1 | regex tags.path=PATH ]
[| search auditSource=SOURCE auditType=TYPE2]
| stats dc(eval(if(auditType="TYPE1",SESSIONS,null()))) as Starts dc(eval(if(auditType="TYPE2",SESSIONS,null()))) as Ends by auditType
| eval PercentCompletion=round(Ends*100/Starts,2)&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 17 May 2022 15:26:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-eval-to-divide-counts-by-auditType/m-p/598109#M208278</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2022-05-17T15:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to create eval to divide counts by auditType?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-eval-to-divide-counts-by-auditType/m-p/598289#M208333</link>
      <description>&lt;P&gt;Hi Somesoni&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've plugged that in but I get the following error (subbed audit type and session field)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Error in 'stats' command: The eval expression for dynamic field 'eval(if(auditType=TYPE1,SESSIONS,null()))' is invalid. Error='Typechecking failed. '-' only takes numbers.'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried replacing the null() with 0 instead to see if that kicked it in but no luck &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for replying &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 10:50:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-eval-to-divide-counts-by-auditType/m-p/598289#M208333</guid>
      <dc:creator>Megz</dc:creator>
      <dc:date>2022-05-18T10:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to create eval to divide counts by auditType?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-eval-to-divide-counts-by-auditType/m-p/598292#M208335</link>
      <description>&lt;P&gt;From the error message it looks like your real field names have "-" in. If this is the case, enclose the field name in &lt;U&gt;single&lt;/U&gt; quotes&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| multisearch
[| search auditSource=SOURCE auditType=TYPE 1 | regex tags.path=PATH ]
[| search auditSource=SOURCE auditType=TYPE2]
| stats dc(eval(if('auditType'="TYPE1",'SESSIONS',null()))) as Starts dc(eval(if('auditType'="TYPE2",'SESSIONS',null()))) as Ends by 'auditType'
| eval PercentCompletion=round(Ends*100/Starts,2)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 18 May 2022 11:37:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-eval-to-divide-counts-by-auditType/m-p/598292#M208335</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-05-18T11:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to create eval to divide counts by auditType?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-eval-to-divide-counts-by-auditType/m-p/598294#M208336</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This works for doing the counting! Thank you so much&lt;/P&gt;&lt;P&gt;The issue now is calculating the % as there are null values in the table. I tried adding in a where clause to the end specifying where Starts&amp;gt;0 and Completions&amp;gt;0 but this doesn't return any results.&lt;/P&gt;&lt;P&gt;p.s. I know the completions are more than the starts just now as this is in a testing environment.&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="Megz_0-1652874813903.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/19698iE2AA7A92CC05FED6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Megz_0-1652874813903.png" alt="Megz_0-1652874813903.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 11:53:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-eval-to-divide-counts-by-auditType/m-p/598294#M208336</guid>
      <dc:creator>Megz</dc:creator>
      <dc:date>2022-05-18T11:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to create eval to divide counts by auditType?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-eval-to-divide-counts-by-auditType/m-p/598296#M208337</link>
      <description>&lt;LI-CODE lang="markup"&gt;| multisearch
[| search auditSource=SOURCE auditType=TYPE 1 | regex tags.path=PATH ]
[| search auditSource=SOURCE auditType=TYPE2]
| stats dc(eval(if('auditType'="TYPE1",'SESSIONS',null()))) as Starts dc(eval(if('auditType'="TYPE2",'SESSIONS',null()))) as Ends
| eval PercentCompletion=round(Ends*100/Starts,2)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 18 May 2022 11:55:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-eval-to-divide-counts-by-auditType/m-p/598296#M208337</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-05-18T11:55:42Z</dc:date>
    </item>
  </channel>
</rss>

