Skip to content

logzio/x509-certificate-metrics-lambda

Repository files navigation

X509 Certificate Lambda

A lambda designed to collect X509 certificate metrics from a URL. The collected metrics will be exported to the Logzio app. This lambda is using the logzio log extension as the log layer, for additional information visit: https://docs.logz.io/shipping/log-sources/lambda-extensions.html

Getting Started

To start just press the button and follow the instructions:

Region Deployment
us-east-1 Deploy to AWS
us-east-2 Deploy to AWS
us-west-1 Deploy to AWS
us-west-2 Deploy to AWS
eu-central-1 Deploy to AWS
eu-north-1 Deploy to AWS
eu-west-1 Deploy to AWS
eu-west-2 Deploy to AWS
eu-west-3 Deploy to AWS
sa-east-1 Deploy to AWS
ap-northeast-1 Deploy to AWS
ap-northeast-2 Deploy to AWS
ap-northeast-3 Deploy to AWS
ap-south-1 Deploy to AWS
ap-southeast-1 Deploy to AWS
ap-southeast-2 Deploy to AWS
ca-central-1 Deploy to AWS

Metrics list:

  • x509_age (duration in milliseconds)
  • x509_expiry (duration in milliseconds)
  • x509_start_date (in seconds passed since 1.1.1970)
  • x509_end_date (in seconds passed since 1.1.1970)

Full list of configurable environment variables

Environment variable Description
LogzioMetricsToken (Required) Token for shipping metrics to your Logz.io account. Find it under Settings > Manage accounts. How do I look up my Metrics account token?
LogzioListener (Required) Your logzio listener url for your region, with no port. i.e: https://listener.logz.io
CertificateURL (Required) The URL to collect x509 certificate metrics from, including port. i.e: https://app.logz.io:443
LambdaTimeout (Optional) The amount of time that Lambda allows a function to run before stopping it. Minimum value is 1 second and Maximum value is 900 seconds. We recommend to start with 300 seconds (5 minutes). Default: 300
CloudWatchEventScheduleExpression (Optional) The scheduling expression that determines when and how often the Lambda function runs. We recommend to start with 10 hour rate. Rate below 6 minutes will cause the lambda to behave unexpectedly due to cold start and custom resource invocation. Default: rate(10 hours)
LogzioLogsToken (Required) Your Logz.io log shipping token.

Build and package:

GOARCH=amd64 GOOS=linux go build -o bootstrap && zip function.zip bootstrap

Changelog:

  • 0.0.3:

    • Auto deployment upon release.
    • Support more regions.
    • Remove LambdaName parameter. Lambda name will derive from Stack Name.
  • v0.0.2:

    • Changed IAMRole and EventRule names to have dynamic names.
    • Added custom resource call in autodeployment.yaml to invoke the lambda upon creation.
  • v0.0.1: Initial release