Knowledge Management

Error in 'SearchParser': The definition of macro 'fileinfo' is expected to be an eval expression that returns a string.

nickt3
Engager

Taking a Udemy Splunk introductory course module about macros.

The string works fine in Search, but not as a macro named fileinfo - get the above error. 

index=web

| eval megabytes=bytes/1024/1024

| stats sum(megabytes) as "Megs" by file

| sort – Megs

nickt3_0-1712340395147.png

 

Labels (1)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

Change the definition of the macro to not be an eval macro by unchecking the "Use eval-based definition" box.  Eval-based definitions are for macros that return a string value.  The fileinfo macro returns a result set so is not an eval.

---
If this reply helps you, Karma would be appreciated.

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Change the definition of the macro to not be an eval macro by unchecking the "Use eval-based definition" box.  Eval-based definitions are for macros that return a string value.  The fileinfo macro returns a result set so is not an eval.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Get the T-shirt to Prove You Survived Splunk University Bootcamp

As if Splunk University, in Las Vegas, in-person, with three days of bootcamps and labs weren’t enough, now ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...