Splunk Search

Error in 'eval' command: The expression is malformed. An unexpected character is reached

sarathipattam
New Member

I was getting when I run the below query, can someone give me the solution pls,

below is my query:

| convert num(actualTimeExtract) as actualTime
|eval buckt=case (
actualTime<1001, “time < 1 sec”,
actualTime>1000 AND actualTime<5001, “1 < time < 5”,
1=1, “time > 15”)
|stats dc(hdr.macaddress) by buckt

0 Karma

MuS
SplunkTrust
SplunkTrust

Hi sarathipattam,

this is most likely a copy/paste problem, you have instead of ". Try the run everywhere search below to see how it works:

| makeresults 
| eval actualTime="1000" 
| eval buckt=case (
    actualTime<1001, "time < 1 sec", 
    actualTime>1000 AND actualTime<5001, "1 < time < 5", 
    1=1, "time > 15")

Hope this helps ...

cheers, MuS

niketn
Legend

@MuS, it was only yesterday that @xpac and I spoke of the devil 😄

https://answers.splunk.com/answers/659050/unicode-characters-in-dashboardssearches.html#answer-65905...

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

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

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  &#x1f680; Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...