Knowledge Management

Need help to get total count

vishwa
Path Finder
index=app-index source=application.logs
| rex field= _raw "RampData :\s(?<RampdataSet>\w+)"
| rex field= _raw "(?<Message>Initial message received with below details|Letter published correctley to ATM subject|Letter published correctley to DMM subject|Letter rejected due to: DOUBLE_KEY|Letter rejected due to: UNVALID_LOG|Letter rejected due to: UNVALID_DATA_APP)"
| chart count over RampdataSet by Message

OUTPUT:

RampdataSetInitial message received with below detailsLetter published correctley to ATM subjectLetter published correctley to DMM subjectLetter rejected due to: DOUBLE_KEYLetter rejected due to: UNVALID_LOGLetter rejected due to: UNVALID_DATA_APP
WAC100010010
WAX301515601560
WAM222020622062
STC331212571257
STX6630096096
OTP2010030030
TTC050505
TAN070707


But we want output as shown below:
Total="Letter published correctley to ATM subject" + "Letter published correctley to DMM subject" + "Letter published correctley to DMM subject" + "Letter rejected due to: DOUBLE_KEY" + "Letter rejected due to: UNVALID_LOG" + "Letter rejected due to: UNVALID_DATA_APP"

|table "Initial message received with below details"  Total

RampdataSetInitial message received with below detailsTotal
WAC1020
WAX30165
WAM22184
STC33150
STX66222
OTP2070
TTC015
TAN021
Labels (1)
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @vishwa 

you can use eval (https://docs.splunk.com/Documentation/SCS/current/SearchReference/EvalCommandOverview) or addtotal (https://docs.splunk.com/Documentation/Splunk/9.2.1/SearchReference/Addtotals), something like this:

index=app-index source=application.logs
| rex field= _raw "RampData :\s(?<RampdataSet>\w+)"
| rex field= _raw "(?<Message>Initial message received with below details|Letter published correctley to ATM subject|Letter published correctley to DMM subject|Letter rejected due to: DOUBLE_KEY|Letter rejected due to: UNVALID_LOG|Letter rejected due to: UNVALID_DATA_APP)"
| chart count over RampdataSet by Message
| eval Total="Letter published correctley to ATM subject" + "Letter published correctley to DMM subject" + "Letter published correctley to DMM subject" + "Letter rejected due to: DOUBLE_KEY" + "Letter rejected due to: UNVALID_LOG" + "Letter rejected due to: UNVALID_DATA_APP"
| table "Initial message received with below details"  Total

 Ciao.

Giuseppe

0 Karma

vishwa
Path Finder

Hi @gcusello  We tried the query you provided eval command, but it not working output is:

RampdataSetInitial message received with below detailsTotal
WAC10Letter published correctley to ATM subject
WAX30Letter published correctley to DMM subject
WAM22Letter rejected due to: DOUBLE_KEY
STC33Letter rejected due to: UNVALID_LOG
STX66Letter rejected due to: UNVALID_DATA_APP

 

We tried addtotals as well, pls see the output:

RampdataSetInitial message received with below detailsTotal
WAC 20
WAX 165
WAM 184
STC 150
STX 222
OTP 70
TTC 15
TAN 21

 

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @vishwa ,

if you run your search, have you the table you shared?

if yes, using the eval I hinted you sum the values ot the columns in the Total value.

You could also use addtotals command that sums all the values for each row:

index=app-index source=application.logs
| rex field= _raw "RampData :\s(?<RampdataSet>\w+)"
| rex field= _raw "(?<Message>Initial message received with below details|Letter published correctley to ATM subject|Letter published correctley to DMM subject|Letter rejected due to: DOUBLE_KEY|Letter rejected due to: UNVALID_LOG|Letter rejected due to: UNVALID_DATA_APP)"
| chart count over RampdataSet by Message
| addtotals 

But also in this case que question is: does your search extract the value for each column?

Ciao.

Giuseppe

 

0 Karma
Get Updates on the Splunk Community!

Splunk Search APIを使えば調査過程が残せます

   このゲストブログは、JCOM株式会社の情報セキュリティ本部・専任部長である渡辺慎太郎氏によって執筆されました。 Note: This article is published in both Japanese ...

Integrating Splunk Search API and Quarto to Create Reproducible Investigation ...

 Splunk is More Than Just the Web Console For Digital Forensics and Incident Response (DFIR) practitioners, ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...