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.
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...