Search code examples
reactjsamazon-web-serviceselasticsearchamazon-s3static-site

Static S3 website (React SPA) logging to Elasticsearch


I'm trying to determine the best Elasticsearch logging strategy for a static S3 website - in my case a React single page application (SPA).

I already have an AWS-hosted ELK stack that I use for other components of my service. I currently use Filebeat on EC2 to directly ship logs to my private VPC Elasticsearch cluster.

Logstash has a plugin to handle S3 access logging. I can enable logging in the SPA website bucket, set up Logstash, and ship the logs. Is there a better solution than a dedicated EC2 instance/docker container with Logstash installed to ship poll and ship logs as they are written to S3? My concern is that this comes with additional monitoring overhead.

What is the [currently] easiest way to ship S3 access logs for a static S3 website to Elasticsearch?


Solution

  • Using AWS Lambda we can stream logs from S3 for ES. AWS already documented the procedure: https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-aws-integrations.html#es-aws-integrations-s3-lambda-es