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!

Stay Connected: Your Guide to February Tech Talks, Office Hours, and Webinars!

&#x1f48c; Keep the new year’s momentum going with our February lineup of Community Office Hours, Tech Talks, ...

Preparing your Splunk Environment for OpenSSL3

The Splunk platform will transition to OpenSSL version 3 in a future release. Actions are required to prepare ...

Incident Response: Reduce Incident Recurrence with Automated Ticket Creation

Culture extends beyond work experience and coffee roast preferences on software engineering teams. Team ...