airflow.providers.amazon.aws.hooks.logs

This module contains a hook (AwsLogsHook) with some very basic functionality for interacting with AWS CloudWatch.

Module Contents

Classes

AwsLogsHook

Interact with AWS CloudWatch Logs

class airflow.providers.amazon.aws.hooks.logs.AwsLogsHook(*args, **kwargs)[source]

Bases: airflow.providers.amazon.aws.hooks.base_aws.AwsBaseHook

Interact with AWS CloudWatch Logs

Additional arguments (such as aws_conn_id) may be specified and are passed down to the underlying AwsBaseHook.

See also

AwsBaseHook

get_log_events(self, log_group, log_stream_name, start_time=0, skip=0, start_from_head=True)[source]

A generator for log items in a single stream. This will yield all the items that are available at the current moment.

Parameters
  • log_group (str) – The name of the log group.

  • log_stream_name (str) – The name of the specific stream.

  • start_time (int) – The time stamp value to start reading the logs from (default: 0).

  • skip (int) – The number of log entries to skip at the start (default: 0). This is for when there are multiple entries at the same timestamp.

  • start_from_head (bool) – whether to start from the beginning (True) of the log or at the end of the log (False).

Return type

dict

Returns

A CloudWatch log event with the following key-value pairs:
’timestamp’ (int): The time in milliseconds of the event.
’message’ (str): The log event data.
’ingestionTime’ (int): The time in milliseconds the event was ingested.

Was this entry helpful?