Splunk Search

How can I split (delimit) and select only certain value?

satheeshkumar55
Engager

IP Field in IIS log is like below.

100.30.24.56,+11.44.66.778,+120.33.44.15,12.567.89.666

I want to get only the IP before first comma. (100.30.24.56 in this case). 

Tried something like below but no luck.

eval IP=split(IP,",")

Labels (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

You were halfway there.  The split function returns a multi-value field.  The next step is to extract the first entry in that multi-value field.

| eval IP=split(IP,",")
| eval IP=mvindex(IP, 0)

 

---
If this reply helps you, Karma would be appreciated.

View solution in original post

satheeshkumar55
Engager

@richgalloway That worked!. Thank you. Upvoted.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

You were halfway there.  The split function returns a multi-value field.  The next step is to extract the first entry in that multi-value field.

| eval IP=split(IP,",")
| eval IP=mvindex(IP, 0)

 

---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...