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.
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".
Then I'd like to know if there is a way to ship the logs to different Elasticsearch indexes, based on their LogGroup.