I’d like to forward CloudWatch logs from various SAM stacks/lambdas (probably to Kinesis and then) to Graylog EC2 instances. The point is that I’d also like to automatically add logs from stacks I deploy later.
How do I automate the process of adding new CW lambda log groups to a stream ending up in Graylog? Or — how can I automatically deploy subscriptions to the log groups once they appear in CloudWatch?
Thank you.
2
Answers
I was building on Marcin's response. The final solution looks quite complicated but it just works once it's done.
Several CloudFormation resources need to be provisioned here:
There were also some manual steps that I needed to perform manually (our environment is not CloudFormation based):
graylog-integrations-plugins
package on all Graylog EC2 instances and restart their respectivegraylog-server
services.You need custom solution for that. One way would be to setup CloudWatch Event rule for CloudFormation events which responds to
CREATE_COMPLETE
.The event would trigger a lambda function, which you have to program, to create the needed CloudWatch groups with subscriptions.