#stdin #logs #cloud-watch #aws #send #stream #group

app stdin-to-cloudwatch

Send logs from stdin to AWS CloudWatch Logs

3 releases (breaking)

0.3.0 Feb 17, 2024
0.2.0 Feb 17, 2024
0.1.0 Feb 17, 2024

#1840 in Network programming

Download history 28/week @ 2024-07-26 3/week @ 2024-08-02 9/week @ 2024-09-20 31/week @ 2024-09-27 5/week @ 2024-10-04

52 downloads per month

MIT license

16KB
239 lines

stdin-to-cloudwatch

Send logs from stdin to AWS CloudWatch Logs

Usage

echo "Hello, World!" | stdin-to-cloudwatch MyLogGroup MyLogStream
  • MyLogGroup is the name of the log group to send the logs to
    • If the log group does not exist, it will be created
  • MyLogStream is the name of the log stream to send the logs to
    • If the log stream does not exist, it will be created
  • The logs are read from stdin, and sent to CloudWatch Logs each line at a time

Installation

cargo install stdin-to-cloudwatch

Options

--region

The AWS region to send the logs to.

echo "Hello, World!" | stdin-to-cloudwatch MyLogGroup MyLogStream --region us-west-2

--endpoint-url

The endpoint URL to send the logs to.
LocalStack users can use this to send logs to LocalStack.

echo "Hello, World!" | stdin-to-cloudwatch MyLogGroup MyLogStream --endpoint-url http://localhost:4566

--remake-log-stream

If the log stream already exists, delete it and create a new one.

echo "Hello, World!" | stdin-to-cloudwatch MyLogGroup MyLogStream --remake-log-stream

-s, --suffix-stream-name-with-timestamp

Append the current timestamp to the log stream name.

echo "Hello, World!" | stdin-to-cloudwatch MyLogGroup MyLogStream --suffix-stream-name-with-timestamp

stream name will be like MyLogStream-1708169869

--pass-through

Pass the logs through to stdout after sending them to CloudWatch Logs.

echo "Hello, World!" | stdin-to-cloudwatch MyLogGroup MyLogStream --pass-through

Dependencies

~19–27MB
~369K SLoC