Code Monkey home page Code Monkey logo

cloudwatchlogs-relay's Introduction

Program cloudwatchlogs-relay listens for rsyslogd messages over unix socket
and sends messages to CloudWatch logs.

To send all logged messages on a host to CloudWatch Logs, configure rsyslogd
by creating file /etc/rsyslog.d/cloudwatch.conf with the following content:

    $ModLoad omuxsock
    $OMUxSockSocket /var/run/cloudwatch
    *.* :omuxsock:

Restart rsyslogd, and run this program like this:

    cloudwatchlogs-relay -socket=/var/run/cloudwatch \
        -group=/groupname/rsyslogd \
        -stream='instance/${INSTANCE_ID}'

This will create log group "/groupname/rsyslogd", and inside it a log stream
"instance/${INSTANCE_ID}", where ${INSTANCE_ID} would be replaced with EC2
instance ID. Supported placeholders for replacement are: ${HOSTNAME},
${INSTANCE_ID}, ${RANDOM} โ€” for instance ID, hostname, and random string. Be
careful to make sure placeholders are not expanded by the shell (use single
quotes).

Program requires the following IAM permissions:

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "logs:CreateLogGroup",
                    "logs:CreateLogStream",
                    "logs:PutLogEvents"
                ],
                "Resource": "*"
            }
        ]
    }

Note that while program tries to remove socket on clean shutdown, it is
still possible that leftover socket file may be left, preventing new
instance from starting.

It relies on AWS SDK and expects to find credentials/region settings in
usual places (IAM role, environment, configuration files).

cloudwatchlogs-relay's People

Contributors

artyom avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.