Ingest Logs Stored on S3
Last updated
Last updated
Many AWS services allow saving logs or other data in S3 buckets for long term storage. It can often be very useful to read that data into groundcover, which is what this page is all about.
groundcover uses a lambda function called groundcover-aws-ingester
that uses AWS trigger mechanism to run the lambda whenever a new file is put inside a bucket. This is a common way to utilize lambdas for these types of tasks. You can read more about .
The following list of services are supported for ingestion. Note the Displayed Source
column, which will be filterable in the platform under the source
filter.
It's possible to ingest arbitrary log data from S3 buckets, assuming the logs are separated by newlines. Data ingested in these cases will appear under the aws-s3
source.
AWS ELB
aws-elb
AWS CloudTrail
aws-cloudtrail
AWS S3
aws-s3
groundcover uses a provided CloudFormation
stack to deploy the lambda function. This is the easiest and recommended method to deploy the lambda function. It also takes care of adding granular permissions on the required resources such as access to the buckets and secret (if configured).
The lambda needs to be deployed inside the target account and region where the S3 buckets reside. If you have multiple accounts or regions, you will need to setup the lambda in each one of them.
We support multiple ways of deploying the stack:
When setting up the stack you will need to provide the following values:
GCAPIKey - the API key used to ingest data into groundcover. Can be retrieved using:
groundcover auth print-api-key
GCSite - your inCloud Managed site, provided to you during installation. Example:
example.platform.grcv.io
BucketARNs - a comma-separated list of buckets that you wish to consume logs from. Example: arn:aws:s3:::my_awesome_bucket,arn:aws:s3:::my_other_awesome_bucket
GCEnvName (optional) - if provided, logs collected will be tagged with this value as env
, making them filterable in the platform accordingly.
LambdaTimeout (optional) - The amount of time (in seconds) that Lambda allows a function to run before stopping it. The default is 30 seconds. The maximum allowed value is 900 seconds.
LambdaMemorySize (optional) - The amount of memory available to the function at runtime. Increasing the function memory also increases its CPU allocation. The default value is 128 MB. The value can be any multiple of 1 MB up to 10240 MB (e.g 128, 256, 512...)
Make sure to choose the correct region after opening the CloudFormation template.
You will need to install the CloudFormation
stack on each account and region where you want to ingest logs from.
There are two ways to install using CloudFormation:
Fill in the configuration parameters detailed above
Continue clicking Next
to create the stack
Access the existing stack created in the previous steps.
Click on Update
in the top right corner
Click Next
once again to retain the existing configuration values
Continue clicking Next
to update the stack
After deploying the lambda function, you will need to add triggers.
groundcover supports multiple types of triggers:
SNS triggers are added in two parts:
Adding notifications from the buckets to an SNS topic
Adding a trigger to the Lambda from the SNS topic
You will need to do this for each SNS topic
You can only configure S3 bucket to send events to SNS in the same region.
However, the SNS topic can be in a different region from the Lambda.
groundcover supports multiple methods of setting up the SNS trigger:
Access the groundcover-aws-ingester
lambda function in the UI, and browse to the Add Trigger
section.
Select SNS as the trigger type.
Enter the SNS topic to trigger the lambda on.
Click on Add.
On each bucket, create an event notification to the SNS topic
Select All object create events
as the Event types
Select the SNS topic from (1) as the destination
Click on Save changes
You can only set triggers on buckets that reside in the same region as the lambda function. If you have buckets in multiple regions, you will need to install the lambda in each one.
After deploying the lambda function, you will need to add triggers on the S3 buckets you want to read logs from. groundcover supports multiple methods of setting up the triggers:
Access the groundcover-aws-ingester
lambda function in the UI, and browse to the Add Trigger
section.
Click on Add
to create the trigger.
Specifiying the BucketARNs does not complete the process; you will also need to add triggers on them, as described .
Click on to jump directly into the installation
This step is only needed if you prefer to use AWS Secret Manager to store the groundcover endpoint details. If you wish to pass them by env, skip to the
See on the relevant configuration parameters
groundcover uses the Terraform resource to deploy the CloudFormation stack directly inside Terraform.
This step is not needed on initial deployment; It's only relevant when a new version of the lambda function is released and you wish to upgrade to it. If this is your first time deploying the function, move on to
Select Replace existing template
and provide this link as Amazon S3 URL
:
You will need to do this for each bucket specified in the
groundcover uses the Terraform resource as seen below:
You will need to provide triggers on each bucket specified in the .
groundcover uses the Terraform resource as seen below:
Access the groundcover platform to view your logs. You can filter based on the source of the data (see ) or based on the env name, if set.