Splunk Search

Splunk newbie question

ncorchado
Explorer

Given my apache access_log URI is /Foobar/FoobarServices, I want to extract Foobar only for my timechart. makemv delim="/" allowempty=t uri returns Foobar and FoobarServices. All I want is the Foobar. How do I do that?

makemv delim="/" allowempty=t uri | timechart count by uri

Thanks!

0 Karma
1 Solution

ncorchado
Explorer

Got it
sourcetype="access_combined" | rex field=uri "^/(?.+?)/" | timechart count by JVM
Thanks!

View solution in original post

dmaislin_splunk
Splunk Employee
Splunk Employee

Cool, please accept the answer and select the up arrow then.

0 Karma

ncorchado
Explorer

Got it
sourcetype="access_combined" | rex field=uri "^/(?.+?)/" | timechart count by JVM
Thanks!

dmaislin_splunk
Splunk Employee
Splunk Employee

Did you get a new field on the left called newfield with this information?

0 Karma

ncorchado
Explorer

Yes. I tried your recommendation and I still get /Foobar/FoobarServices. I just want to capture Foobar.

0 Karma

dmaislin_splunk
Splunk Employee
Splunk Employee

Are you just trying to extract information between the / and create a new field?

sourcetype="access_combined" | rex field=uri "^/(?.+?)/"

Something like this?

0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...