Splunk Search

[Help] Creating a new Field for matching Value

Zyon
Engager

Hi,

Currently, my Splunk search is:

sourcetype="Blacklist" OR sourcetype="log" | eval blacklisted=if(sourcetype=="Blacklist",_raw,null()) | fields - _raw | fields blacklisted,SRC 

I am able to see two fields, blacklisted and SRC.

May i ask if it is possible to do the following:

  • Create a new field to store values that matches between the 2 fields.

Thanks a lot!

Tags (1)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

If by "matches between the 2 fields" you mean if they equal each other, you can do this:

sourcetype="Blacklist" OR sourcetype="log" | eval blacklisted=if(sourcetype=="Blacklist",_raw,null()) | fields - _raw | fields blacklisted,SRC | eval matches = if(blacklisted==SRC, "match", "no match")

If you're thinking of something else then please elaborate.

View solution in original post

0 Karma

gkanapathy
Splunk Employee
Splunk Employee
0 Karma

Zyon
Engager

Thanks a lot!

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

If by "matches between the 2 fields" you mean if they equal each other, you can do this:

sourcetype="Blacklist" OR sourcetype="log" | eval blacklisted=if(sourcetype=="Blacklist",_raw,null()) | fields - _raw | fields blacklisted,SRC | eval matches = if(blacklisted==SRC, "match", "no match")

If you're thinking of something else then please elaborate.

0 Karma

Zyon
Engager

Yes, this is what i'm thinking of. Thanks a lot!

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...