Splunk Search

Why comparision not working when field is having value "*"

ma_anand1984
Contributor

fieldA is the extracted field already available
fieldB is eval field

| eval fieldB=*

| where fieldA=fieldB

Here im trying to match all values of fieldA. above command is not working

where as if i give
| eval fieldB=test

| where fieldA=fieldB
then it matches fieldA with value test

Im trying to do something complex , this is the part where i am stuck

Tags (2)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

The eval command treats the asterisk character as multiplication.

If your task is complex I recommend regular expressions, for example to match everything:

... | eval fieldB=".*" | where match(fieldA, fieldB)

To match "test":

... | eval fieldB="^test$" | where match(fieldA, fieldB)

View solution in original post

martin_mueller
SplunkTrust
SplunkTrust

The eval command treats the asterisk character as multiplication.

If your task is complex I recommend regular expressions, for example to match everything:

... | eval fieldB=".*" | where match(fieldA, fieldB)

To match "test":

... | eval fieldB="^test$" | where match(fieldA, fieldB)

Ayn
Legend

Just as an FYI, you don't need to call format at the end of a subsearch, because it will be called implicitly anyway.

ma_anand1984
Contributor

I prefer using your way. its faster 🙂

0 Karma

ma_anand1984
Contributor

thank you for the tip. I actually wrote a subsearch to achieve it !!!!

[search |stats count |eval fieldA= if("APP"=="APP","*","test") | fields fieldA| format]

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 ...