Skip to content

Ship Logs from CloudWatch Logs to Elasticsearch #1

Closed
@0x4D31

Description

@0x4D31

First, I'm not sure if the following script is correct for shipping logs from CloudWatch Logs to Elasticsearch. After I run the lambda script, it logs "Handling event for CloudWatch logs", but then I get this error: "Event did not match any mappings".

shipper = require('lambda-stash');

exports.handler = function(event, context, callback) {
  var config = {
    elasticsearch: {
      host: 'something.us-west-2.es.amazonaws.com',
      index: 'logs',
      region: 'us-west-2',
      useAWS: true
    },
    mappings: [
      {
       processors: [
         'formatCloudwatchLogs',
         'shipElasticsearch' 
       ],
       elasticsearch: {
          type: 'test'
        }
      }
    ]
  };
  shipper.handler(config, event, context, callback);
};

Then I'd like to know if there is a way to ship the logs to different Elasticsearch indexes, based on their LogGroup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions