Amazon Prometheus Service

2025/05/22 - Amazon Prometheus Service - 4 new api methods

Changes  Add QueryLoggingConfiguration APIs for Amazon Managed Prometheus

UpdateQueryLoggingConfiguration (new) Link ¶

Updates the query logging configuration for the specified workspace.

See also: AWS API Documentation

Request Syntax

client.update_query_logging_configuration(
    clientToken='string',
    destinations=[
        {
            'cloudWatchLogs': {
                'logGroupArn': 'string'
            },
            'filters': {
                'qspThreshold': 123
            }
        },
    ],
    workspaceId='string'
)
type clientToken:

string

param clientToken:

(Optional) A unique, case-sensitive identifier that you can provide to ensure the idempotency of the request.

This field is autopopulated if not provided.

type destinations:

list

param destinations:

[REQUIRED]

The destinations where query logs will be sent. Only CloudWatch Logs destination is supported. The list must contain exactly one element.

  • (dict) --

    Defines a destination and its associated filtering criteria for query logging.

    • cloudWatchLogs (dict) -- [REQUIRED]

      Configuration details for logging to CloudWatch Logs.

      • logGroupArn (string) -- [REQUIRED]

        The ARN of the CloudWatch log group to which the vended log data will be published. This log group must exist prior to calling this operation.

    • filters (dict) -- [REQUIRED]

      Filtering criteria that determine which queries are logged.

      • qspThreshold (integer) -- [REQUIRED]

        The Query Samples Processed (QSP) threshold above which queries will be logged. Queries processing more samples than this threshold will be captured in logs.

type workspaceId:

string

param workspaceId:

[REQUIRED]

The ID of the workspace for which to update the query logging configuration.

rtype:

dict

returns:

Response Syntax

{
    'status': {
        'statusCode': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING'|'CREATION_FAILED'|'UPDATE_FAILED',
        'statusReason': 'string'
    }
}

Response Structure

  • (dict) --

    • status (dict) --

      The current status of the query logging configuration.

      • statusCode (string) --

        The current status of the query logging configuration.

      • statusReason (string) --

        If there is a failure, the reason for the failure.

CreateQueryLoggingConfiguration (new) Link ¶

Creates a query logging configuration for the specified workspace. This operation enables logging of queries that exceed the specified QSP threshold.

See also: AWS API Documentation

Request Syntax

client.create_query_logging_configuration(
    clientToken='string',
    destinations=[
        {
            'cloudWatchLogs': {
                'logGroupArn': 'string'
            },
            'filters': {
                'qspThreshold': 123
            }
        },
    ],
    workspaceId='string'
)
type clientToken:

string

param clientToken:

(Optional) A unique, case-sensitive identifier that you can provide to ensure the idempotency of the request.

This field is autopopulated if not provided.

type destinations:

list

param destinations:

[REQUIRED]

The destinations where query logs will be sent. Only CloudWatch Logs destination is supported. The list must contain exactly one element.

  • (dict) --

    Defines a destination and its associated filtering criteria for query logging.

    • cloudWatchLogs (dict) -- [REQUIRED]

      Configuration details for logging to CloudWatch Logs.

      • logGroupArn (string) -- [REQUIRED]

        The ARN of the CloudWatch log group to which the vended log data will be published. This log group must exist prior to calling this operation.

    • filters (dict) -- [REQUIRED]

      Filtering criteria that determine which queries are logged.

      • qspThreshold (integer) -- [REQUIRED]

        The Query Samples Processed (QSP) threshold above which queries will be logged. Queries processing more samples than this threshold will be captured in logs.

type workspaceId:

string

param workspaceId:

[REQUIRED]

The ID of the workspace for which to create the query logging configuration.

rtype:

dict

returns:

Response Syntax

{
    'status': {
        'statusCode': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING'|'CREATION_FAILED'|'UPDATE_FAILED',
        'statusReason': 'string'
    }
}

Response Structure

  • (dict) --

    • status (dict) --

      The current status of the query logging configuration.

      • statusCode (string) --

        The current status of the query logging configuration.

      • statusReason (string) --

        If there is a failure, the reason for the failure.

DeleteQueryLoggingConfiguration (new) Link ¶

Deletes the query logging configuration for the specified workspace.

See also: AWS API Documentation

Request Syntax

client.delete_query_logging_configuration(
    clientToken='string',
    workspaceId='string'
)
type clientToken:

string

param clientToken:

(Optional) A unique, case-sensitive identifier that you can provide to ensure the idempotency of the request.

This field is autopopulated if not provided.

type workspaceId:

string

param workspaceId:

[REQUIRED]

The ID of the workspace from which to delete the query logging configuration.

returns:

None

DescribeQueryLoggingConfiguration (new) Link ¶

Retrieves the details of the query logging configuration for the specified workspace.

See also: AWS API Documentation

Request Syntax

client.describe_query_logging_configuration(
    workspaceId='string'
)
type workspaceId:

string

param workspaceId:

[REQUIRED]

The ID of the workspace for which to retrieve the query logging configuration.

rtype:

dict

returns:

Response Syntax

{
    'queryLoggingConfiguration': {
        'createdAt': datetime(2015, 1, 1),
        'destinations': [
            {
                'cloudWatchLogs': {
                    'logGroupArn': 'string'
                },
                'filters': {
                    'qspThreshold': 123
                }
            },
        ],
        'modifiedAt': datetime(2015, 1, 1),
        'status': {
            'statusCode': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING'|'CREATION_FAILED'|'UPDATE_FAILED',
            'statusReason': 'string'
        },
        'workspace': 'string'
    }
}

Response Structure

  • (dict) --

    • queryLoggingConfiguration (dict) --

      The detailed information about the query logging configuration for the specified workspace.

      • createdAt (datetime) --

        The date and time when the query logging configuration was created.

      • destinations (list) --

        The configured destinations for the query logging configuration.

        • (dict) --

          Defines a destination and its associated filtering criteria for query logging.

          • cloudWatchLogs (dict) --

            Configuration details for logging to CloudWatch Logs.

            • logGroupArn (string) --

              The ARN of the CloudWatch log group to which the vended log data will be published. This log group must exist prior to calling this operation.

          • filters (dict) --

            Filtering criteria that determine which queries are logged.

            • qspThreshold (integer) --

              The Query Samples Processed (QSP) threshold above which queries will be logged. Queries processing more samples than this threshold will be captured in logs.

      • modifiedAt (datetime) --

        The date and time when the query logging configuration was last modified.

      • status (dict) --

        The current status of the query logging configuration.

        • statusCode (string) --

          The current status of the query logging configuration.

        • statusReason (string) --

          If there is a failure, the reason for the failure.

      • workspace (string) --

        The ID of the workspace associated with this query logging configuration.