Splunk Search

Search in single table with multiple stats

mawani
Engager

Hello,

I am having logs in splunk in below manner.

timestamp "LOGGER= PAGE NAME1 Other text"
timestamp "LOGGER= PAGE NAME1 Other text"
timestamp "LOGGER= PAGE NAME2 Other text"
timestamp "LOGGER= PAGE NAME2 Other text"
timestamp "LOGGER= PAGE NAME3 Other text"
timestamp "LOGGER= PAGE NAME3 Other text"
timestamp "LOGGER= PAGE NAME1 Other text"


I formatted search query
index=index-name ns="namespace" | rex field=_raw "LOGGER=\s*(?<PAGE_NAME1>PAGE NAME1*)" | stats count by PAGE_NAME1
| append [search
index=index-name ns="namespace" | rex field=_raw "LOGGER=\s*(?<PAGE_NAME2>PAGE NAME2*)" | stats count by PAGE_NAME2 ]
| append [search
index=index-name ns="namespace" | rex field=_raw "LOGGER=\s*(?<PAGE_NAME3>PAGE NAME3*)" | stats count by PAGE_NAME3 ]


Got result like

PAGE_NAME1CountPAGE_NAME2PAGE_NAME3
PAGE NAME13  
 2PAGE NAME2 
 2 PAGE NAME3


I am looking result should look below

Page NamePages Visited
PAGE_NAME13
PAGE_NAME32
PAGE_NAME32

Any idea how to format search query ?

Labels (1)
0 Karma
1 Solution

somesoni2
Revered Legend

Try like this

index=index-name ns="namespace" | rex field=_raw "LOGGER=\s*(?<PAGE_NAME>(PAGE NAME1|PAGE NAME2|PAGE NAME3)*)" | stats count by PAGE_NAME1

View solution in original post

0 Karma

somesoni2
Revered Legend

Try like this

index=index-name ns="namespace" | rex field=_raw "LOGGER=\s*(?<PAGE_NAME>(PAGE NAME1|PAGE NAME2|PAGE NAME3)*)" | stats count by PAGE_NAME1
0 Karma

mawani
Engager

Thank You for very quick response and it is working

0 Karma
Get Updates on the Splunk Community!

What the End of Support for Splunk Add-on Builder Means for You

Hello Splunk Community! We want to share an important update regarding the future of the Splunk Add-on Builder ...

Solve, Learn, Repeat: New Puzzle Channel Now Live

Welcome to the Splunk Puzzle PlaygroundIf you are anything like me, you love to solve problems, and what ...

Building Reliable Asset and Identity Frameworks in Splunk ES

 Accurate asset and identity resolution is the backbone of security operations. Without it, alerts are ...