Splunk Search

Contains "is null" with if command

Shakira1
Explorer

I have all_ip filed that contains all my ips.

now I want to split it to public ip and private ip:

public_ip, private_ip, all_ip:

and when private_ip is null I want to put the value from all_ip in public_ip field. 

first I did: 

| eval private_ip=if(like(all_ip,"XXXX.%") OR like(all_ip,"XXX.%"),all_ip,null())

and now I need to do (all the rest fill it in public_ip field. 

this is possible? 

thanks!

Labels (2)
Tags (1)
0 Karma
1 Solution

Manasa_401
Communicator

Hello @Shakira1 

Try the below line.

| eval public_ip=if(isnull(private_ip),all_ip,"NO")

you can change the value in else as you prefer

 

If this helps, karma would be appreciated.

Thanks,

Manasa

View solution in original post

0 Karma

Shakira1
Explorer

thanks! 

0 Karma

Manasa_401
Communicator

Hello @Shakira1 

Try the below line.

| eval public_ip=if(isnull(private_ip),all_ip,"NO")

you can change the value in else as you prefer

 

If this helps, karma would be appreciated.

Thanks,

Manasa

0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...