Splunk Search

adding value output rows from a stats table

rhallinan
Engager

I have the following search. 

index=main_index sourcetype="hec:google" operationName=createMobileAuthenticationOutcome direction=response source="customers-mobile-authentications-v1"
| dedup correlationId
| stats count by eventData.log{}.downstreamRequestAdditionalLog.request.applicationEntryType eventData.log{}.downstreamRequestAdditionalLog.request.authenticationOutcome
| sort -count
| eventstats sum(count) as tot by eventData.log{}.downstreamRequestAdditionalLog.request.applicationEntryType
| eval perc = round(count/tot*100,1)
| stats list(eventData.log{}.downstreamRequestAdditionalLog.request.authenticationOutcome) as "OutCome Request Details" list(count) as Count, list(perc) as "% per Auth Type" by eventData.log{}.downstreamRequestAdditionalLog.request.applicationEntryType
| appendpipe
[ stats sum(Count) as Count, sum("% per Auth Type") as "% per Auth Type" by eventData.log{}.downstreamRequestAdditionalLog.request.applicationEntryType
| eval "OutCome Request Details" = "Total Request"]
| sort eventData.log{}.downstreamRequestAdditionalLog.request.applicationEntryType
| rename eventData.log{}.downstreamRequestAdditionalLog.request.applicationEntryType as "Auth Type"

which shows this table. But.... 

3DS MI Report Stats Table.JPG

What I want to do is add another row for the total number of directOpenApp.Completed and pushNotifications.Completed

I've tried addtotals and can't get my head around appendcols.

Thanks

r

Labels (1)
0 Karma

PickleRick
SplunkTrust
SplunkTrust

appendpipe sounds great but it won't work that straightforward with multivalued fields.

I can't seem to be able to do a "dynamic addressing" of multivalued fields so I could mvfind a position in one list and find a value in another one (something like field.(mvfind(another_field,"value")) - it doesn't work).

Furthermore, expanding mvfields with mvexpand - well, you can't do it "pairwise". You could do mvzip to produce pairs but it's getting even more ugly and you still have filtering ahead of you. Ugly as hell.

So I'd rather skip the "stats list" from the original search. Or at least moved it way to the end - until all the calculations are complete.

richgalloway
SplunkTrust
SplunkTrust

It sounds like you're wanting to add a subtotal column.  If so, see the examples for the appendpipe command (https://docs.splunk.com/Documentation/Splunk/8.2.2/SearchReference/Appendpipe#Examples) for how to that.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

AI for AppInspect

We’re excited to announce two new updates to AppInspect designed to save you time and make the app approval ...

App Platform's 2025 Year in Review: A Year of Innovation, Growth, and Community

As we step into 2026, it’s the perfect moment to reflect on what an extraordinary year 2025 was for the Splunk ...

Operationalizing Entity Risk Score with Enterprise Security 8.3+

Overview Enterprise Security 8.3 introduces a powerful new feature called “Entity Risk Scoring” (ERS) for ...