Splunk Search

Error in 'eval' command: The expression is malformed.

KeaganJ
Path Finder

Hi 

I am getting the following error on my application/dashboard:
" Error in 'eval' command: The expression is malformed."

The query that is being triggered is:

| makeresults count=1 | eval id=$incident_id$| sendalert canary_acknowledge_incident param.incident_id=$incident_id$ param.index_name="main"
 
And this is getting triggered when a Submit Button is being clicked.
The Submit button is tied to a Dropdown of values.
The dropdown is populated with values and is defined as below:
<input type="dropdown" token="incident_id" searchWhenChanged="false">
 <label>Incident to Close</label>
 <fieldForLabel>id</fieldForLabel>
 <fieldForValue>id</fieldForValue>
 <search>
  <query>`canary_tools_index` sourcetype="canarytools:incidents" | stats values(id) as id| mvexpand id</query>
  <earliest>-30d@d</earliest>
  <latest>now</latest>
 </search>
</input>

And running that drop down populating query using the Search tool gives information such as:

incident:canarytoken:80f36193721b94fb268bb6df:<source_ip>:<epoch_timestamp>
incident:canarytoken:80f36193721b94fb268bb6df:<source_ip>:<epoch_timestamp>

 

Looking at previous questions asked on this forum point towards the field names of the `eval` command not working whenever they start with a numeric character. But this is not the case in my issues as I am using :
`eval id=$incident_id$`

 

This is happening on Splunk 8.0.0

Labels (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @KeaganJ,

try to add quotes to the eval and sendalert commands:

| makeresults count=1 
| eval id="$incident_id$"
| sendalert canary_acknowledge_incident param.incident_id="$incident_id$" param.index_name="main"

Ciao.

Giuseppe

View solution in original post

KeaganJ
Path Finder

I managed to fix my issue by surrounding the variable in double quotes ie:

eval id="$incident_id$"
0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @KeaganJ,

good!

Ciao and happy splunking.

Giuseppe

P.S.: Karma Points are appreciated 😉

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @KeaganJ,

try to add quotes to the eval and sendalert commands:

| makeresults count=1 
| eval id="$incident_id$"
| sendalert canary_acknowledge_incident param.incident_id="$incident_id$" param.index_name="main"

Ciao.

Giuseppe

KeaganJ
Path Finder

Thanks Giuseppe Just saw your reply now as I refreshed the page. Your solution works great for me.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

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

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...

Index This | How many sevens are there between 1 and 100?

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