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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...