blob: 7b82a7de14b857efa9e5f3ca2ed72af638d50cbe [file] [log] [blame]
:py:mod:`airflow.providers.amazon.aws.log.cloudwatch_task_handler`
==================================================================
.. py:module:: airflow.providers.amazon.aws.log.cloudwatch_task_handler
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.amazon.aws.log.cloudwatch_task_handler.CloudwatchTaskHandler
.. py:class:: CloudwatchTaskHandler(base_log_folder, log_group_arn, filename_template)
Bases: :py:obj:`airflow.utils.log.file_task_handler.FileTaskHandler`, :py:obj:`airflow.utils.log.logging_mixin.LoggingMixin`
CloudwatchTaskHandler is a python log handler that handles and reads task instance logs.
It extends airflow FileTaskHandler and uploads to and reads from Cloudwatch.
:param base_log_folder: base folder to store logs locally
:param log_group_arn: ARN of the Cloudwatch log group for remote log storage
with format ``arn:aws:logs:{region name}:{account id}:log-group:{group name}``
:param filename_template: template for file name (local storage) or log stream name (remote)
.. py:method:: hook(self)
Returns AwsLogsHook.
.. py:method:: set_context(self, ti)
Provide task_instance context to airflow task handler.
:param ti: task instance object
.. py:method:: close(self)
Close the handler responsible for the upload of the local log file to Cloudwatch.
.. py:method:: get_cloudwatch_logs(self, stream_name)
Return all logs from the given log stream.
:param stream_name: name of the Cloudwatch log stream to get all logs from
:return: string of all logs from the given log stream