Giter Site home page Giter Site logo

lambda-logging-kinesis-demo's Introduction

lambda-logging-kinesis-demo

Demo of how to ship logs from CloudWatch Logs to a Kinesis stream, and then ship them to Logz.io

A group of Lambda functions for:

  • shipping logs from Kinesis stream to Logz.io (hosted ELK stack)
  • auto-subscribe new log groups to the configured Kinesis stream so you don't have to subscribe them manually
  • auto-updates the retention policy of new log groups to 7 days (configurable)

Deployment

  1. insert the logstash_host, logstash_port and token in the serverless.yml file (under the ship-logs-to-logzio function's environment variables).

token: your Logz.io account token. Can be retrieved on the Settings page in the Logz.io UI. logstash_host: if you are in the EU region insert listener-eu.logz.io, otherwise, use listener.logz.io. You can tell which region you are in by checking your login URL - app.logz.io means you are in the US. app-eu.logz.io means you are in the EU. logstash_port: this should be 5050, but is subject to change. See this page for details.

for example:

ship-logs-to-logzio:
  handler: functions/ship-logs/handler.handler
  description: Sends CloudWatch logs from Kinesis to Logz.io
  environment:
    logstash_host: listener.logz.io
    logstash_port: 5050
    token: CduNgGwuFFeUVzbXvqVDXoGkjxEdKzc9
  1. run ./build.sh deploy dev to deploy to a stage called "dev"

Updating existing log groups

  1. open the process_all.js script

  2. fill in the missing configuration values

  3. run node process_all.js

lambda-logging-kinesis-demo's People

Contributors

omry-hay avatar theburningmonk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

lambda-logging-kinesis-demo's Issues

Missing build.sh

Hello

Your installation instructions mention running "build.sh". Should this be present in the repo?

DestinationArn for vendor kinesis cannot be used without roleArn

Hi @theburningmonk.

I am getting the following error in the subscribe function when I create a new log group.

{
    "errorMessage": "destinationArn for vendor kinesis cannot be used without roleArn",
    "errorType": "InvalidParameterException",
    "stackTrace": [
        "Request.extractError (/var/task/node_modules/aws-sdk/lib/protocol/json.js:48:27)",
        "Request.callListeners (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:105:20)",
        "Request.emit (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:77:10)",
        "Request.emit (/var/task/node_modules/aws-sdk/lib/request.js:683:14)",
        "Request.transition (/var/task/node_modules/aws-sdk/lib/request.js:22:10)",
        "AcceptorStateMachine.runTo (/var/task/node_modules/aws-sdk/lib/state_machine.js:14:12)",
        "/var/task/node_modules/aws-sdk/lib/state_machine.js:26:10",
        "Request.<anonymous> (/var/task/node_modules/aws-sdk/lib/request.js:38:9)",
        "Request.<anonymous> (/var/task/node_modules/aws-sdk/lib/request.js:685:12)",
        "Request.callListeners (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:115:18)"
    ]
}

If I add the roleArn property as:

let options = {
    destinationArn: arn,
    logGroupName: logGroupName,
    filterName: 'ship-logs',
    filterPattern: '[timestamp=*Z, request_id="*-*", event]',
    roleArn: role_arn,
  }

and

      role_arn:
        Fn::GetAtt:
          - CloudWatchLogsRole
          - Arn

Then I get the following error.

{
    "errorMessage": "User: arn:aws:sts::275307759108:assumed-role/cloudwatch-logs-to-logzio-dev-subscribe-eu-west-1-lambdaRole/cloudwatch-logs-to-logzio-dev-subscribe is not authorized to perform: iam:PassRole on resource: arn:aws:iam::275307759108:role/cloudwatch-logs-to-logzio-dev-cloudwatchrole",
    "errorType": "AccessDeniedException",
    "stackTrace": [
        "Request.extractError (/var/task/node_modules/aws-sdk/lib/protocol/json.js:48:27)",
        "Request.callListeners (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:105:20)",
        "Request.emit (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:77:10)",
        "Request.emit (/var/task/node_modules/aws-sdk/lib/request.js:683:14)",
        "Request.transition (/var/task/node_modules/aws-sdk/lib/request.js:22:10)",
        "AcceptorStateMachine.runTo (/var/task/node_modules/aws-sdk/lib/state_machine.js:14:12)",
        "/var/task/node_modules/aws-sdk/lib/state_machine.js:26:10",
        "Request.<anonymous> (/var/task/node_modules/aws-sdk/lib/request.js:38:9)",
        "Request.<anonymous> (/var/task/node_modules/aws-sdk/lib/request.js:685:12)",
        "Request.callListeners (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:115:18)"
    ]
}

Any thought what can it be? I haven't modify the code from the repo.

Thanks,
Pedro

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.