Skip to content

Cloudwatch repository

__init__(credentials=None, log_group=None, log_stream=None)

CloudWatch repository.

PARAMETER DESCRIPTION
credentials

AWS credentials. If not provided, the extension configuration will be used.

TYPE: AWSCredentials | None DEFAULT: None

log_group

Log group name. If not specified, the configured log group will be used.

TYPE: str | None DEFAULT: None

log_stream

Log stream name. If not specified, the configured log stream will be used.

TYPE: str | None DEFAULT: None

filter_events(filters)

Filters events based on provided filter criteria.

PARAMETER DESCRIPTION
filters

filters to apply.

TYPE: Filters

get_event(event_id)

Retrieves a single event from the repository.

PARAMETER DESCRIPTION
event_id

event ID.

TYPE: str

RETURNS DESCRIPTION
Optional[Event]

types.Event | None: event object or None if not found.

remove_all_events()

Removes all events from the repository.

RETURNS DESCRIPTION
Result

types.Result: result of the operation.

remove_event(event_id)

Remove operation is not supported for CloudWatch logs.

As of today, you cannot delete a single log event from CloudWatch log stream, the alternative will be using Lambda functions: set a Lambda function trigger, filter all logs, then write the remaining logs to a new log group/stream, then delete the original log stream.

It's potentially too expensive to do this operation, so it's not implemented.

Note

The remove single event operation is not supported

remove_events(filters)

See remove_event method docstring.

test_connection()

Tests the connection to the repository.

RETURNS DESCRIPTION
bool

whether the connection was successful.

TYPE: bool

write_event(event)

Writes a single event to the repository.

PARAMETER DESCRIPTION
event

event to write.

TYPE: Event

RETURNS DESCRIPTION
Result

types.Result: result of the operation.