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!

Index This | What is broken 80% of the time by February?

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

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...