/helix-coralogix-feeder

Service that subscribes to AWS CloudWatch logs for Franklin services and pushes them to Coralogix.

Primary LanguageJavaScriptApache License 2.0Apache-2.0

Franklin Coralogix Feeder

Service that subscribes to CloudWatch logs for Franklin services and pushes them to Coralogix.

Status

codecov CircleCI GitHub license GitHub issues LGTM Code Quality Grade: JavaScript semantic-release

Installation

The AWS Console has an issue where a subscription filter can not be added with a specific version or alias, we therefore recommend to use the AWS CLI.

Given the service you want to push logs into Coralogix for, e.g. helix-services--my-service, use the following command:

$ aws logs put-subscription-filter \
  --log-group-name /aws/lambda/helix-services--my-service \
  --filter-name helix-coralogix-feeder \
  --filter-pattern '[timestamp=*Z, request_id="*-*", event]' \
  --destination-arn 'arn:aws:lambda:<region>:<accountid>:function:helix-services--coralogix-feeder:v1'

If you get an error that CloudWatch is not allowed to execute your function, add the following permission:

aws lambda add-permission \
    --function-name 'arn:aws:lambda:<region>:<accountid>:function:helix-services--coralogix-feeder:v1' \
    --statement-id 'CloudWatchInvokeCoralogixFeeder' \
    --principal 'logs.amazonaws.com' \
    --action 'lambda:InvokeFunction' \
    --source-arn 'arn:aws:logs:<region>:<accountId>:log-group:/aws/lambda/helix-services--my-service:*' \
    --source-account '<accountId>'

The service uses the following environment variables:

Name Description Required Default
CORALOGIX_API_KEY Coralogix Private Key Yes -
CORALOGIX_LOG_LEVEL Log level No info
CORALOGIX_SUBSYSTEM Subsystem No second segment in log group name, e.g. helix-services

If delivery to Coralogix fails, the service will send the unprocessed messages to the AWS SQS queue named helix-coralogix-feeder-dlq.

Development

Deploying Franklin Coralogix Feeder

All commits to main that pass the testing will be deployed automatically. All commits to branches that will pass the testing will get commited as helix-services--coralogix-feeder@ci<num> and tagged with the CI build number.