Splunk Search

stats. eval and search macros?

jgauthier
Contributor

I am using a search macro in an eval and it returns all zeros. But, when I expand it, it functions as expected. Is that normal?

ie:

 `get_all_email` | stats count(eval(`receive_event`)) as Sent by recipientlist

This returns all zeros.

`get_all_email` | stats count(eval(((event_id="DELIVER" AND source_id="STOREDRIVER") OR (event_id=1023)))) as Sent by recipientlist

This works perfectly.

Tags (2)
0 Karma
1 Solution

jgauthier
Contributor

Interesting. I think there was something wrong with the macros.conf file. I opened it to paste the contents, and it looked like this:

[receive_event]
definition = ( (event_id="DELIVER" AND source_id="STOREDRIVER") OR\
(event_id=1023) )\

iseval = 0

My other eval/macro was working that looked like this:

[send_event]
definition = ( (event_id="TRANSFER" AND source_id="ROUTING") OR (event_id=1033) )
iseval = 0

So, I modified the receive_event manually to look like this:

[receive_event]
definition = ( (event_id="DELIVER" AND source_id="STOREDRIVER") OR (event_id=1023) )
iseval = 0

And now it seems to be working.

View solution in original post

jgauthier
Contributor

Interesting. I think there was something wrong with the macros.conf file. I opened it to paste the contents, and it looked like this:

[receive_event]
definition = ( (event_id="DELIVER" AND source_id="STOREDRIVER") OR\
(event_id=1023) )\

iseval = 0

My other eval/macro was working that looked like this:

[send_event]
definition = ( (event_id="TRANSFER" AND source_id="ROUTING") OR (event_id=1033) )
iseval = 0

So, I modified the receive_event manually to look like this:

[receive_event]
definition = ( (event_id="DELIVER" AND source_id="STOREDRIVER") OR (event_id=1023) )
iseval = 0

And now it seems to be working.

gkanapathy
Splunk Employee
Splunk Employee

that looks like a bug in the UI putting linebreaks into the macro.

0 Karma

gkanapathy
Splunk Employee
Splunk Employee

it would be helpful to see your macro definition/macros.conf file.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...