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!

New Year, New Changes for Splunk Certifications

As we embrace a new year, we’re making a small but important update to the Splunk Certification ...

[Puzzles] Solve, Learn, Repeat: Unmerging HTML Tables

[Puzzles] Solve, Learn, Repeat: Unmerging HTML TablesFor a previous puzzle, I needed some sample data, and ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...