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!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...