Splunk Search

Coalesce Function

IRHM73
Motivator

Hi, I wonder whether someone may be able to help me please.

I've been reading the Splunk documentation on the 'coalesce' function and understand the principals of this.

The example in the Splunk documentation highlights this scenario:

Let's say you have a set of events
where the IP address is extracted to
either clientip or ipaddress. This
example defines a new field called ip,
that takes the value of either
clientip or ipaddress, depending on
which is not NULL (exists in that
event): ... | eval
ip=coalesce(clientip,ipaddress)

Could someone tell me please, how I would be able to amend this to look for a speciifc ip address.

Many thanks and kind regards

Chris

1 Solution

sundareshr
Legend

Not sure I understand your question... In the above example, you will not have 3 fields clientip, ipaddress and the newly created ip. if you just looking to search for a specific ip address after the coalesce command, you could do ..|search ip=<> or you could do the same without the coalesce ..| search (clientip=<> OR ipaddress=<>). Coalesce is useful when you want to transform the data ..| stats count ip by host when you need all the ip address information in one field.

View solution in original post

sundareshr
Legend

Not sure I understand your question... In the above example, you will not have 3 fields clientip, ipaddress and the newly created ip. if you just looking to search for a specific ip address after the coalesce command, you could do ..|search ip=<> or you could do the same without the coalesce ..| search (clientip=<> OR ipaddress=<>). Coalesce is useful when you want to transform the data ..| stats count ip by host when you need all the ip address information in one field.

IRHM73
Motivator

Hi @sundareshr, thank you very much for this explanation, it's really very useful.

Kind Regards

Chris

0 Karma

jkat54
SplunkTrust
SplunkTrust

Right, but you would search for the IP address prior to running coalesce to reduce the overhead and resource usage of coalesce.

192.168.0.1 | ...

0 Karma

IRHM73
Motivator

HI @jkat54, thank you very much for the explanation, really very useful.

Kind Regards

Chris

0 Karma
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!

May 2026 Splunk Expert Sessions: Security & Observability

Level Up Your Operations: May 2026 Splunk Expert Sessions Whether you are refining your security posture or ...

Network to App: Observability Unlocked [May & June Series]

In today’s digital landscape, your environment is no longer confined to the data center. It spans complex ...

SPL2 Deep Dives, AppDynamics Integrations, SAML Made Simple and Much More on Splunk ...

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...