Splunk Search

Can you help me make a regex for URL having different types of parameters?

arjun_krishna
Explorer

I have below 2 log sets which have different activities. i want two different regex for Set1 and Set2 separately in 2 different panels

Set1
log1:
index="abc_xyz"|activity=GET->/cirrus/v2.0/payloads/96a-d3f-4fb/HELLO_WORLD|eventEndTime=2018-09-26
log2:
index="abc_xyz"|activity=GET->/cirrus/v2.0/payloads/f4a-8ef-8cb/abcpayld|eventEndTime=2018-09-26

Set2
log3:
index="abc_xyz"|activity=GET->/cirrus/v2.0/payloads/96a-d3f-4fb/HELLO_WORLD/fd078jkkj24342kljlce989dadc7abc56c28|eventEndTime=2018-09-26
log4:
index="abc_xyz"|activity=GET->/cirrus/v2.0/payloads/f4a-8ef-8cb/abcpayld/thfd078jkkj24342kljlce989dadc7vfc56c28|eventEndTime=2018-09-26

I have tried with below , but No luck

index="abc_xyz" |regex "GET->\/cirrus\/v2.0\/payloads\/([[:alnum:]-]{10,40})\/([[:alpha:]_]{10,40})"

Could you please resolve my query

Tags (2)
0 Karma
1 Solution

FrankVl
Ultra Champion

Assuming the difference between the two sets is that set1 has 5 segments in the URL and set2 has 6 segments, you could try:

regex for set1: ^GET-\>(\/[^\/]+){5}$
https://regex101.com/r/aHAhTo/1

regex for set2: ^GET-\>(\/[^\/]+){6}$
https://regex101.com/r/aHAhTo/2

View solution in original post

mstjohn_splunk
Splunk Employee
Splunk Employee

@arjun_krishna

Did you try out the answer below? If it helped, would please resolve this post by approving it?
If your problem is still not solved, keep us updated so that someone else can help ya. Thanks for posting!

0 Karma

FrankVl
Ultra Champion

Assuming the difference between the two sets is that set1 has 5 segments in the URL and set2 has 6 segments, you could try:

regex for set1: ^GET-\>(\/[^\/]+){5}$
https://regex101.com/r/aHAhTo/1

regex for set2: ^GET-\>(\/[^\/]+){6}$
https://regex101.com/r/aHAhTo/2

Get Updates on the Splunk Community!

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...

Integrating Splunk Search API and Quarto to Create Reproducible Investigation ...

 Splunk is More Than Just the Web Console For Digital Forensics and Incident Response (DFIR) practitioners, ...

Congratulations to the 2025-2026 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...