API
LogEvent
CloudWatchLogs.LogEvent
— Type.LogEvent(message::AbstractString, datetime=Dates.now(tz"UTC"))
LogEvent(message::AbstractString, timestamp)
Log event for submission to CloudWatch Logs.
Streams
CloudWatchLogs.CloudWatchLogStream
— Method.CloudWatchLogStream(config::AWSConfig, log_group_name, log_stream_name)
Create a reference to a CloudWatch Log Stream on AWS with the log group name and log stream name. This constructor will automatically fetch the latest sequence token for the stream.
CloudWatchLogs.create_group
— Function.create_group(config::AWSConfig) -> String
create_group(config::AWSConfig, log_group_name) -> String
Create a CloudWatch Log Group. If the log group name is not provided, one is generated using a UUID4.
Returns the log group name.
CloudWatchLogs.create_stream
— Function.create_stream(config::AWSConfig, log_group_name) -> String
create_stream(config::AWSConfig, log_group_name, log_stream_name) -> String
Create a CloudWatch Log Stream under a given Log Group. If the log stream name is not provided, one is generated using a UUID4.
Returns the log stream name.
CloudWatchLogs.delete_group
— Method.delete_stream(config::AWSConfig, log_group_name)
Delete a CloudWatch Log Group.
CloudWatchLogs.delete_stream
— Method.delete_stream(config::AWSConfig, log_group_name, log_stream_name)
Delete a CloudWatch Log Stream from a given Log Group.
CloudWatchLogs.submit_log
— Method.submit_log(stream::CloudWatchLogStream, event::LogEvent) -> Int
Call submit_logs
with one event.
CloudWatchLogs.submit_logs
— Method.submit_logs(stream::CloudWatchLogStream, events::AbstractVector{LogEvent}) -> Int
Submit a list of log events to AWS.
None of the log events can be more than 2 hours in the future, or older than 14 days or the retention period of the log group. If this occurs, those log messages will be rejected but the rest will succeed.
Submission of all log events will fail if:
- the log events are more than 1 MiB of data
- the log events are not in chronological order by timestamp
- there are more than 10000 log events in
events
- the log events span more than 24 hours
Returns the number of events successfully submitted.
Handler
CloudWatchLogs.CloudWatchLogHandler
— Method.CloudWatchLogHandler(
config::AWSConfig,
log_group_name,
log_stream_name,
formatter::Memento.Formatter,
)
Construct a Memento Handler for logging to a CloudWatch Log Stream. This constructor creates a task which asynchronously submits logs to the stream.
A CloudWatch Log Event has only two properties: timestamp
and message
.
If a Record
has a date
property it will be used as the timestamp
, otherwise the current time will be captured when Memento.emit
is called. All DateTime
s will be assumed to be in UTC.
The message
will be generated by calling Memento.format
on the Record
with this handler's formatter
.