tracing-cloudwatch is a custom tracing-subscriber layer that sends your application's tracing events(logs) to AWS CloudWatch Logs.
feature rusoto
required
```rust use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
async fn main() { let cwclient = rusotologs::CloudWatchLogsClient::new(rusoto_core::Region::ApNortheast1);
tracing_subscriber::registry::Registry::default()
.with(
tracing_cloudwatch::layer().with_client(
cw_client,
tracing_cloudwatch::ExportConfig::default()
.with_batch_size(5)
.with_interval(std::time::Duration::from_secs(1))
.with_log_group_name("tracing-cloudwatch")
.with_log_stream_name("stream-1"),
),
)
.init();
} ```
feature awssdk
required
```rust use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
async fn main() { let config = awsconfig::loadfromenv().await; let cwclient = awssdkcloudwatchlogs::Client::new(&config);
tracing_subscriber::registry::Registry::default()
.with(
tracing_cloudwatch::layer().with_client(
cw_client,
tracing_cloudwatch::ExportConfig::default()
.with_batch_size(5)
.with_interval(std::time::Duration::from_secs(1))
.with_log_group_name("tracing-cloudwatch")
.with_log_stream_name("stream-1"),
),
)
.init();
} ```
Currently, following AWS IAM Permissions required
logs:PutLogEvents
This project is licensed under the MIT license.