Splunk Search

Splunk Search regex

avsplunkuser007
Engager

Hello, 

My first post!!!

I have a bunch of results that show up when searched. One of the example is 

Aug 5 19:08:12 ServerName Aug 5, 2020 19:08:12 GMT|50000|APP|UNKNOWN|XXX.XXX.XXX.XXX|XXX.XXX.XXX.XXX|XXX.XXX.XXX.XXX|443|XXXXX|-|/someprocess.php|-|A message posted successfully|500 

Aug 5 19:08:10 ServerName Aug 5, 2020 19:08:10 GMT|50000|APP|UNKNOWN|XXX.XXX.XXX.XXX|XXX.XXX.XXX.XXX|XXX.XXX.XXX.XXX|443|XXXXX|-|/newprocess.php|-|A message posted successfully|200

I want to do a stats count by the .php processes. So, how do i add these or eval/stats these .php processes / scripts ? 

Labels (6)
0 Karma

Anam
Community Manager
Community Manager

Welcome to Splunk Answers! avesplunkuser007 We have some awesome contributors who help out users actively. Feel free to message me if you have any questions or concerns.

0 Karma

thambisetty
SplunkTrust
SplunkTrust

The events look like very much structured and values are delimited with pipe symbol.

you can use IFX(Interactive Field Extraction) to extract them very nicely.

https://docs.splunk.com/Documentation/Splunk/8.0.5/Knowledge/ExtractfieldsinteractivelywithIFX

————————————
If this helps, give a like below.

isoutamo
SplunkTrust
SplunkTrust

And adding more Splunk features here, you could do this with props.conf and transforms.conf on search heads on search time ,-)

All these suggestions  will work, it's your chose to select which own is best for your current needs.

r. Ismo

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Welcome!

To do stats on the field you first need to extract it.  The rex command does that.

index=foo
| rex "\/(?<file>\w+\.\w+)"
| stats count by file

 

---
If this reply helps you, Karma would be appreciated.

ITWhisperer
SplunkTrust
SplunkTrust

It looks like the script name is the 11th field assuming "|" is the delimiter so something like this might work

... base search ...
| eval logmessage=_raw
| makemv delim="|" logmessage
| eval script=mvindex(logmessage,10)
| stats count by script

Indexes start at zero so index 10 for the 11th field 

Get Updates on the Splunk Community!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...