Getting Data In

get_global_setting returns api_key as "undefined"

KeaganJ
Path Finder

I have made a Tech add on that polls an API. In order to perform requests against the API, an API key is required.

I have used the following as the example in order to get the URL and the API key for the request saved onto Splunk:
https://github.com/splunk/Developer_Guidance_Setup_View_Example

When I look at the app specific conf files ( ie /opt/splunk/etc/apps/TA-eg/local/ta_eg_settings.conf)

Then I see that the api_key is starred out, ie encrypted at rest:

 

 

 

[additional_parameters]
api_key = ********
eg_domain = <correct_plaintext_domain>
disabled = 0

 

 

 

However if I attempt to use the python helper function get_global_setting("api_key"as defined in:

https://docs.splunk.com/Documentation/AddonBuilder/3.0.2/UserGuide/PythonHelperFunctions

Then it is always returning the string "undefined" as opposed to the correct API key that I added.

 

In TA-eg/bin/TA_eg_rh_settings.py  I have also set encrypted = True for the correct field:

 

 

 

fields_additional_parameters = [
    field.RestField(
        'eg_domain',
        required=True,
        encrypted=False,
        default='',
        validator=validator.String(
            min_len=0, 
            max_len=8192, 
        )
    ), 
    field.RestField(
        'api_key',
        required=True,
        encrypted=True,
        default='',
        validator=validator.String(
            min_len=0, 
            max_len=8192, 
        )
    )
]

 

 

 

 

Please help me figure out how to get the correct output using the Splunk helper functions.

Labels (1)
0 Karma
Get Updates on the Splunk Community!

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...