Splunk Search

How to use delimiter to filter data from a selected field in splunk??

gcd24967
Explorer

Hi  ,

I have my log entries line below:

2023-08-22T10:48:01.340641-07:00 ARC1 (PID:63766948): Archived Log entry 176651 added for T-1.S-31459 ID 0xffffffffadc86430
Labels (2)
0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

There are a couple of other ways you can do this to expand on @isoutamo reply, one (rex) with a different regex, where you don't always know the parts of the path and one (eval) where you always want the 4th element of the path

| rex field=source "(/[^/]*){3}/(?<db_name>[^/]+)"
| eval db_name=mvindex(split(source, "/"), 4)

 

View solution in original post

bowesmana
SplunkTrust
SplunkTrust

There are a couple of other ways you can do this to expand on @isoutamo reply, one (rex) with a different regex, where you don't always know the parts of the path and one (eval) where you always want the 4th element of the path

| rex field=source "(/[^/]*){3}/(?<db_name>[^/]+)"
| eval db_name=mvindex(split(source, "/"), 4)

 

gcd24967
Explorer

Thanks a lot for the help.

It worked as intended.

0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

you could try something like

....
| rex field=source "/rdbms/(?<db_name>[^/]+)" 

If I understand right you already have hostname in host field?

r. Ismo

Get Updates on the Splunk Community!

Observe and Secure All Apps with Splunk

  Join Us for Our Next Tech Talk: Observe and Secure All Apps with SplunkAs organizations continue to innovate ...

Splunk Decoded: Business Transactions vs Business IQ

It’s the morning of Black Friday, and your e-commerce site is handling 10x normal traffic. Orders are flowing, ...

Fastest way to demo Observability

I’ve been having a lot of fun learning about Kubernetes and Observability. I set myself an interesting ...