<?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: Add individual logs by field to produce a count in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487206#M136187</link>
    <description>&lt;P&gt;unfortunately, I'm still getting the same error. FYI,  &lt;/P&gt;

&lt;P&gt;processedObject=processedObject[attribute1=ID, attribute2=VERSION, attribute3=TYPE1, attribute4=TYPE2, failure=null]&lt;/P&gt;

&lt;P&gt;this is the log I'm trying to get a count of: I specifically need failure=null in this log, that's why I'm trying ("processedObject=" AND "failure=null"). Reading up on searchmatch, I think it takes in a boolean argument. so I'm not sure how to go about fixing this.&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jan 2020 16:29:44 GMT</pubDate>
    <dc:creator>thenormalone</dc:creator>
    <dc:date>2020-01-28T16:29:44Z</dc:date>
    <item>
      <title>Add individual logs by field to produce a count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487199#M136180</link>
      <description>&lt;P&gt;I have several different timers in the logs which are in the format below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;INFO: [timerName=TimerName.RestTransaction
        timerMessage="Transaction Success" or "Transaction Failure"
    timerDuration= time in milliseconds
    sourceClass=sourceClass][domain=example.com][user=exampleUser][correlation-id=uniqueId]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and one of the logs of the format&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;processedObject=processedObject[attribute1=ID, attribute2=VERSION, attribute3=TYPE1, attribute4=TYPE2, failure=null]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to add/subtract the different timerName events (with transaction success message)  and the log message above &lt;STRONG&gt;by user&lt;/STRONG&gt; and display a table with user and the count(percentage) associated. &lt;/P&gt;

&lt;P&gt;I tried (Here I'm trying to get the percentage of the count by user in the end)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="Exampleindex" (timerName=Timer1.RestTransaction) | stats count as Event1 by user
    | appendcols [ search index="Exampleindex" (timerName=Timer2.RestTransaction) | stats count as Event2 by user]
    | appendcols [ search index="Exampleindex" (timerName=Timer3.RestTransaction) | stats count as Event3 by user]
    | appendcols [ search index="Exampleindex" (timerName=Timer4.RestTransaction)  | stats count as Event4 by user]
    | appendcols [ search index="Exampleindex" ("processedObject=" AND "failureMetadata=null")| stats count as Event5 by user]
    | eval total1 = Event1 + Event2 - Event3 + Event4 - Event 5
    | eval total2 = Event1 + Event2 - Event3 + Event4
    | eval percentage = ((total1/total2) * 100)
    | fields count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm not entirely sure how to go about this, any help is appreciated!&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jan 2020 13:13:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487199#M136180</guid>
      <dc:creator>thenormalone</dc:creator>
      <dc:date>2020-01-14T13:13:04Z</dc:date>
    </item>
    <item>
      <title>Re: Add individual logs by field to produce a count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487200#M136181</link>
      <description>&lt;PRE&gt;&lt;CODE&gt; Index=example
 | eval rest1=if(timerName=="Timer1.RestTransaction",1,0)
 | eval rest2=if(timerName=="Timer2.RestTransaction",1,0)
 | eval rest3=if(timerName=="Timer3.RestTransaction",1,0)
 | eval rest4=if(timerName=="Timer4.RestTransaction",1,0)
 | eval rest5=if(searchmatch("processedObject=* AND "failureMetadata=null"),1,0)
 | where isnotnull(rest1) OR isnotnull(rest2) OR isnotnull(rest3) OR isnotnull(rest4) OR isnotnull(rest5)
 | stats sum(rest1) as r1 sum(rest2) as r2 sum(rest3) as r3 sum(rest4) as r4 sum(rest5) as r5 count as total by user
 | eval pctR1=(r1/total)*100
 | eval pctR2=(r2/total)*100
 | eval pctR3=(r3/total)*100
 | eval pctR4=(r4/total)*100
 | eval pctR5=(r5/total)*100
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Jan 2020 00:35:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487200#M136181</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-01-28T00:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Add individual logs by field to produce a count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487201#M136182</link>
      <description>&lt;P&gt;You'll want to change the evals on the end of the search to have your adds and subtractions, but then you'll have to add/subtract their counts from the total count before getting a percentage too.... can be done but hard to type on my mobile!&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 00:40:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487201#M136182</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2020-01-28T00:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: Add individual logs by field to produce a count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487202#M136183</link>
      <description>&lt;P&gt;Thanks for taking the time to look at this. Appreciate it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Apologies for the amateur question but I'm getting a "The arguments to the 'searchmatch' function are invalid." with the following.&lt;/P&gt;

&lt;P&gt;eval rest5=if(searchmatch('"processedObject=" AND "failureMetadata=null"'),1,0)&lt;/P&gt;

&lt;P&gt;I've unsuccessfully tried to play with the different combinations&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 04:52:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487202#M136183</guid>
      <dc:creator>thenormalone</dc:creator>
      <dc:date>2020-01-28T04:52:27Z</dc:date>
    </item>
    <item>
      <title>Re: Add individual logs by field to produce a count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487203#M136184</link>
      <description>&lt;P&gt;my end goal is to have a table which has the user and his percentage&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 04:56:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487203#M136184</guid>
      <dc:creator>thenormalone</dc:creator>
      <dc:date>2020-01-28T04:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Add individual logs by field to produce a count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487204#M136185</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;index="Exampleindex" timerName=* OR ("processedObject=" AND "failure=null") 
| stats count(eval(timerName="Timer1.RestTransaction")) as Event1
, count(eval(timerName="Timer2.RestTransaction")) as Event2
, count(eval(timerName="Timer3.RestTransaction")) as Event3
, count(eval(timerName="Timer4.RestTransaction")) as Event4 
, count(eval(searchmatch("processedObject"))) as Event5 by user
| eval total2 = Event1 + Event2 - Event3 + Event4
| eval total1 = total2 - Event 5
| eval percentage = round((total1/total2) * 100,2)
| table user percentage
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi, @thenormalone&lt;BR /&gt;
&lt;CODE&gt;stats&lt;/CODE&gt; can use &lt;CODE&gt;eval&lt;/CODE&gt;.&lt;BR /&gt;
how about this?&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 10:54:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487204#M136185</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-28T10:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: Add individual logs by field to produce a count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487205#M136186</link>
      <description>&lt;PRE&gt;&lt;CODE&gt; | eval rest5=if(searchmatch("processedObject=") AND searchmatch("failureMetadata=null"),1,0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;try this.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 11:01:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487205#M136186</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-28T11:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Add individual logs by field to produce a count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487206#M136187</link>
      <description>&lt;P&gt;unfortunately, I'm still getting the same error. FYI,  &lt;/P&gt;

&lt;P&gt;processedObject=processedObject[attribute1=ID, attribute2=VERSION, attribute3=TYPE1, attribute4=TYPE2, failure=null]&lt;/P&gt;

&lt;P&gt;this is the log I'm trying to get a count of: I specifically need failure=null in this log, that's why I'm trying ("processedObject=" AND "failure=null"). Reading up on searchmatch, I think it takes in a boolean argument. so I'm not sure how to go about fixing this.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 16:29:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487206#M136187</guid>
      <dc:creator>thenormalone</dc:creator>
      <dc:date>2020-01-28T16:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: Add individual logs by field to produce a count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487207#M136188</link>
      <description>&lt;P&gt;This works too but for Event5, &lt;/P&gt;

&lt;P&gt;processedObject=processedObject[attribute1=ID, attribute2=VERSION, attribute3=TYPE1, attribute4=TYPE2, failure=null]&lt;/P&gt;

&lt;P&gt;this is the log I'm trying to get a count of: So I specifically need failure=null in this log, that's why I'm trying ("processedObject=" AND "failure=null"). Reading up on searchmatch, I think it takes in a boolean argument. so I'm not sure how to go about fixing this.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 16:30:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487207#M136188</guid>
      <dc:creator>thenormalone</dc:creator>
      <dc:date>2020-01-28T16:30:42Z</dc:date>
    </item>
    <item>
      <title>Re: Add individual logs by field to produce a count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487208#M136189</link>
      <description>&lt;P&gt;I made the change to just do &lt;BR /&gt;
count(eval(searchmatch("processedObject"))) as Sign by user&lt;/P&gt;

&lt;P&gt;since my search already includes ("processedObject=" AND "failure=null") and this worked! &lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2020 17:11:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-individual-logs-by-field-to-produce-a-count/m-p/487208#M136189</guid>
      <dc:creator>thenormalone</dc:creator>
      <dc:date>2020-01-28T17:11:48Z</dc:date>
    </item>
  </channel>
</rss>

