Splunk Search

Issue with Splunk Query Stats not brining in all values

bhartiya008
Explorer

Hi All,

I have a log which has below lines in it:

"Results":{"Elapsed":"0","Message":"No of Application to Obsolete in Teradata : 4","TraceLevel":"INFO"},"Security":{"Vendor":"CRAB"}}
"Results":{"Elapsed":"0","Message":"Total Application Asset in Teradata : 1696","TraceLevel":"INFO"},"Security":{"Vendor":"CRAB"}}
"Results":{"Elapsed":"0","Message":"Total Application count from SPAM : 1694","TraceLevel":"INFO"},"Security":{"Vendor":"CRAB"}}
"Results":{"Elapsed":"0","Message":" Application/s to Obsolete in Teradata : [PA00007618, PA00007617, PA00007619, PA00007620]","TraceLevel":"INFO"},"Security":{"Vendor":"CRAB"}}

 

I want the output to have the below fields:
No of Application to Obsolete in Teradata : 4
Total Application Asset in Teradata : 1696
Total Application count from SPAM : 1694
Application/s to Obsolete in Teradata : [PA00007618, PA00007617, PA00007619, PA00007620]

I have built below query but it's only giving me one record :

ExecutionDate Host Total Application count from SPAM : 1694



index=hdt  sourcetype=Teradata_SPAM_logs  | fields -_raw
| where match(_raw, "Host_cdc") and (match(_raw,"Total\sApplication\scount\sfrom\sSPAM\s*") 
OR match(_raw,"Total\sApplication\sAsset\sin\sTeradata\s*") 
OR match(_raw,"No\sof\sApplication\sto\sObsolete\sin\sTeradata\s*") 
OR match(_raw,"List\sof\sApplications\sin\sTeradata\sto\sbe\smarked*") 
)
| rex "(?<Summary>\"Message\":(.*\w+)\s:.*)" 
| rex "(?<Host>\"Host\":(.*\",))" 
| rex "(?<ExecutionDate>\d{4}\-\d{2}\-\d{2})" 
| rex field=Summary mode=sed "s/\"Message\":\"/ /"
| rex field=Summary mode=sed "s/\"TraceLevel.*/ /"
| rex field=Summary mode=sed "s/\".*$//"
| rex field=Host mode=sed "s/\"Channel.*/ /" 
| rex field=Host mode=sed "s/\"Host\":\"/ /" 
| rex field=Host mode=sed "s/\/.*/ /"
| eval Host = replace(Host,"Host_cdc.cdc.CRAB.com", "PRODUCTION") 
| eval Host = replace(Host,"Host_DEV.cdc.CRAB.com", "PROFILING") 
| eval Host = replace(Host,"Host_PP.cdc.CRAB.com", "VALIDATION") 
| stats  values(Summary) as Summary by ExecutionDate, Host
| where isnotnull(Summary)

Can anyone tell me where is the problem here?

Labels (3)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Try these rex

| rex "\"Message\":\"(?<Summary>[^\"]+)" 
| rex "\"Host\":\"(?<Host>[^\"]+)" 
| rex "(?<ExecutionDate>\d{4}\-\d{2}\-\d{2})" 
0 Karma

bhartiya008
Explorer

When I run the part till match ..I am able to see all the 4 rows in the event data.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Are all the examples from the production host, or do you have a mixture?

0 Karma

bhartiya008
Explorer

We have a mixture there and I am picking only for production.
Even if I remove that where clause for the host I am still getting one row which is very strange.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

The final line of your example doesn't match the where clause, but that doesn't explain why only one does.

0 Karma

bhartiya008
Explorer

@ITWhisperer -- tried the below , but still getting the same one row.

0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk, and empower your SOC to reach new heights! Duration: 1 hour  Prepare to ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...