Getting Data In

Referencing global settings inside SimpleXML?

mlstomasevic
New Member

Hi,

I am looking for a way to access one of the global settings parameters directly from the simplexml and to be rendered on the dashboard. For example, globalConfig.json stores a couple of fields that I use to store application specific data, and would be great if I could render this data on the dashboard as well. I am familiar with the $env but I can't really find how to access anything that is stored in the global settings file. Is this even possible? Thanks.

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@mlstomasevic

We can help if you share your app details. Like it is from splunk base or your custom app.

0 Karma

mlstomasevic
New Member

It is a custom app. Do you need more details?

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

Yes please.

0 Karma

mlstomasevic
New Member

I'm just getting started with Splunk, but basically I created a dummy app through Add-on builder, and was wondering if there's a way to access App's Configuration values inside the templates? For example, by default there is a Add-on Settings tab on the configuration page for the App, and I was wondering if there's a way to access those values inside the template? Basically I want to access global config value from the template.

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@mlstomasevic
globalConfig.json is AOB generated files with a single control to different page/tab configurations. And I found only base.html file in the initial AOB generated TA. Do you want to access globalconfig.json in this template file? /SPLUNK_HOME/etc/apps/YOUR_APP/appserver/templates/base.html. If yes, then may I know the purpose of doing this? Bcoz, base.html is designed in such manner which will load other supporting javascript form appserver/static/js/build/ which is responsible for creating input tabs and configuration tab with all functionalities using globalConfig.json. Any changes in this file may cause UI issue.

If you have UI related requirement then you can play with globalConfig.json by referring already implemented elements in the same file.

0 Karma

mlstomasevic
New Member

Actually, I just want to display a value from globalConfig.json inside one of the dashboards, that's it. Not change it any way.

0 Karma

mlstomasevic
New Member

@kamlesh_vaghela Let me correct myself. I thought that I need to access globalConfig.json because I believed that global conf values are stored there. What I really need to display inside dashboard template is just the Add-on parameter field values for an App, that Add-on builder offers to configure. I guess Splunk store those as key-value pairs somewhere.

0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

@mlstomasevic If you want to access configurations which are stored from the configuration tab OR input tab then you can use | rest search command. Rest command will give you access to all configured values. globalConfig.json is not the file where configuration stored. There are conf files which store the configuration stanzas.

Please check below links to know more about conf files.

https://docs.splunk.com/Splexicon:Configurationfile
https://docs.splunk.com/Documentation/Splunk/7.2.4/Admin/Listofconfigurationfiles
https://docs.splunk.com/Documentation/Splunk/7.2.3/Admin/Configurationfilestructureandsyntax

Well, if you have created a dashboard in AOB generated TA then make sure your configuration pages storing configurations. Then after you can use | rest search command to access key-values.

Try: | rest /services/configs/conf-myapp (or optionally, constrain the app and user: | rest /servicesNS/admin/myapp/configs/conf-myapp).

You can find more using the below links.

https://docs.splunk.com/Documentation/Splunk/7.2.4/SearchReference/Rest

Kindly let know for further assistance.

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 ...