Splunk Search

Regex Help in splunk 6.1.3

pavanae
Builder

The following were the different strings visible in my splunk search results…

"SYSTEM_USE_CD" : "C"
"SYSTEM_RSP_CD" : "0100"
"SYSTEM_STAT_CD" : "ACCEPT"

Now with the help of regex in my search string i want to display only these values and also want to see their stats count for these three of them like

system_cd Count

"SYSTEM_USE_CD" : "C" (some count)
"SYSTEM_RSP_CD" : "0100" (some count)

"SYSTEM_STAT_CD" : "ACCEPT" (some count)

Please help me how to display these stats from a splunk search with the help of regex

0 Karma
1 Solution

alacercogitatus
SplunkTrust
SplunkTrust

You could do something like this:

<your_search> | rex field=_raw "SYSTEM_(?<system_cd>[^_]+)_CD.\s*:\s*\"(?<system_cd_value>[^\"]+)" | stats count by system_cd system_cd_value

You will probably also want to auto-extract these as well, it will keep your searches clean.

View solution in original post

alacercogitatus
SplunkTrust
SplunkTrust

You could do something like this:

<your_search> | rex field=_raw "SYSTEM_(?<system_cd>[^_]+)_CD.\s*:\s*\"(?<system_cd_value>[^\"]+)" | stats count by system_cd system_cd_value

You will probably also want to auto-extract these as well, it will keep your searches clean.

pavanae
Builder

Worked Great Thanks..

0 Karma

echalex
Builder

Hi,

Can you post some sample lines? It is not completely clear from the context what sort of regex would do the trick.

0 Karma
Get Updates on the Splunk Community!

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...