Manage Python versions in Splunk Cloud Platform

The Admin Config Service (ACS) API lets you change the Python runtime version of your Splunk Cloud Platform deployment on a self-service basis. You can use this functionality to rollback the Python version in case you experience failures as a result of migration to a newer python version, and upgrade the Python version once those issues are resolved.

Requirements

To change the Python version using the ACS API:

  • You must have the sc_admin role.
Note: Python version change requires a restart. The ACS endpoint does not trigger an immediate restart. Splunk Cloud Platform triggers the restart internally on a nightly basis.
Note: Python version change can take up to to 24 hours to complete.

Set up the ACS API

Before using the ACS API, you must download the ACS OpenAPI 3.0 specification, which includes the parameters, response codes, and other data you need to work with the ACS API.

You must also create an authentication token in Splunk Cloud Platform for use with ACS endpoint requests. For details on how to set up the ACS API, see Set up the ACS API.

Manage the Python version using the ACS API

You can use the ACS API to check the current Python runtime version of your deployment and change the Python version if necessary.

Check the current Python version

To check the current Python runtime version, send an HTTP GET request to the python-runtime endpoint. For example:

curl 'https://admin.splunk.com/{stack-name}/adminconfig/v2/python-runtime' \
--header 'Authorization: Bearer eyJraWQ...'

The response shows the current Python runtime version. Supported values are force_python3, python3, python3.7, python3.9, and python2. For example:

{
  "pythonRuntime": "force_python3"
}

For endpoint details, see python-runtime in the ACS endpoint reference.

Change the Python version

To change the Python runtime version for your deployment, send an HTTP POST request to the python-runtime endpoint, specifying the pythonVersion value in the request body. For example:

curl -X POST 'https://admin.splunk.com/{stack-name}/adminconfig/v2/python-runtime' \
   --header 'Authorization: Bearer eyJraWQ...' \
   -H "Content-Type: application/json" \
   --data '{
                "pythonVersion" : "python2"
        }'

The response indicates that the Python version has been rolled back to Python 2:

{
  "message": "pythonVersion rolled back to python2"
}

For endpoint details, see python-runtime in the ACS endpoint reference.