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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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