I created an app that uses the setup.xml file to allow easy configuration. The app is configured to use two macros that I want to setup through the setup.xml file, which looks like this:
This works fine and the administrator can setup the application. However, I noticed that after setting up the application, the macro is not visible for normal users of Splunk, who get the following error:
In splunkd.log I can see this error:
It works perfect for the admin user, and I can see in <appdir>/local/macros.conf that the new macros have been created correctly, but it doesn't work for normal users.
Am I using a wrong endpoint? Or something additional has to be done for normal users?
asked 15 Aug '11, 02:05
I ran into something similar recently. Basically the problem is that because macros are not shared by default, you have to mark them as shared in the app config. As an app developer you get used to everything being shared or even 'global' (for instance savedsearches are shared by default so they dont need this trick) but macros are for some reason different.
So the solution is probably just as simple as packaging a 'default.meta' file in the 'metadata' directory of your app, that looks like this. (lets say your macro is called 'foo')
All this does is make that macro shared to all users of your app, and that might be all it takes. I cant be sure -- I had a little more going on since I was using a custom endpoint, not the default setup.xml behavior, so i cant say for sure.
Also make sure that if your testing has created a situation where you have two 'foo' macros in manager, where one is the 'no-owner' one, and one is a 'private' one, delete the private one or the code can get pretty confused and give you weird errors.