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!

How to Get Started with Splunk Data Management Pipeline Builders (Edge Processor & ...

If you want to gain full control over your growing data volumes, check out Splunk’s Data Management pipeline ...

Out of the Box to Up And Running - Streamlined Observability for Your Cloud ...

  Tech Talk Streamlined Observability for Your Cloud Environment Register    Out of the Box to Up And Running ...

Splunk Smartness with Brandon Sternfield | Episode 3

Hello and welcome to another episode of "Splunk Smartness," the interview series where we explore the power of ...