Splunk Search

Error in Eval in Search Command. Please help.

ReachDataScient
Explorer

| makeresults
| eval ipaddress=192.168.1.1
| lookup AM ipaddress OUTPUT hostname
| table ipaddress,hostname
This works fine if I place the ipaddess between the double quotes other wise it throws Error in 'eval' command. The number 192.168.1.1 is invalid.

Any clue.

Tags (1)
0 Karma
1 Solution

tiagofbmm
Influencer

When you are putting an ip address, the "." is concatenating strings that are actually numbers, hence the error like "type mismatch"

View solution in original post

0 Karma

prabhu77749
Explorer

Wierd it works with out quotes for you .. but we should keep the value in double quotes to work..

| eval client_ip=192.162.207.160 - The number 192.162.207.160 is invalid.
| eval client_ip="192.162.207.160" - works fine

0 Karma

tiagofbmm
Influencer

When you are putting an ip address, the "." is concatenating strings that are actually numbers, hence the error like "type mismatch"

0 Karma

somesoni2
Revered Legend

IP address is a string, so it should be enclosed in double quotes. That's the syntax.

0 Karma

ReachDataScient
Explorer

On a dashboard I have an input text field where user can type the IP Address and I pass this as a token to the panel search shown above. The user would never type IP Address in double quotes, so they see the Error in 'eval' command. The number 192.168.1.1 is invalid display in the panel.

0 Karma

somesoni2
Revered Legend

You can either update your query to use the token within quotes OR update your text box to include double quotes as prefix/suffix for that. With that, you'd need to include a label/.note in your dashboard to instruct use to NOT enter with double quotes.

0 Karma

tiagofbmm
Influencer

Or just check whether your user input IP contains the \" or not and proceed accordingly by removing them or not

0 Karma

tiagofbmm
Influencer

Just use "$ip_token$" and carry on. It's up to you to take care of that if the user won't type the IP between quotes

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!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...