loggrp

command
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Log Group

The out-of-the box `AWS::Logs::LogGroup` does not allow to create log groups in different region. This can be useful in the case of lambda@edge functions that are always created in the us-east-1 region but that always log in the nearest region where they are used. To configure those log groups via cloudformation (retention, tags), we have the `loggrp` custom resource lambda.

## Syntax To create a new log group, add the following resource to your cloudformation template (yaml notation, json is similar)

```yaml MyLogGroup:

Type: Custom::LogGroup
Properties:
  ServiceToken:
    Fn::ImportValue:
      !Sub ${HyperdriveCore}-LogGroup
  LogGroupName: <log group name>
  Region: <region of the loggrp>
  RetentionInDays: <retention in days>
  Tags:
    <key>: <value>
    ...

```

## Properties

`ServiceToken`

> The reference to the ARN of this lambda function; imported via the > hyperdrive core stack. > > _Type_: ARN > > _Required_: Yes

`LogGroupName`

> The name of the log group. It is also its ID. > > _Type_: String > > _Required: Yes > > _Update Requires_: Replacement

`Region`

> The region for the log group. This is mostly useful to create log > group outside the us-east-1 region for lamdba@edge functions. > > _Type_: Region (string) > > _Required_: No > > _Update Requires_: Replacement if different from the current region

`RetentionInDays`

> Period of retention of the logs. > > _Type_: Integer as String > > _Required_: No > > _Update Requires_: No interruption

`Tags`

> Tags to apply on the log group. > > _Type_: map of String to String. The keys are the names of the tags > and the values are the values of the tags. > > _Required_: No > > _Update Requires_: No interruption

## Return Values

`Ref`

The `Ref` intrinsic function gives the name of the log group.

`Fn::GetAtt`

The resource gives the ARN of the log group under the attribute `Arn`.

## Example

The following example creates a log group with 90 days retention in the eu-west-1 region.

```yaml LambdaEdgeLogGroupEuWest1:

Type: Custom::LogGroup
Properties:
  ServiceToken:
    Fn::ImportValue:
      !Sub ${HyperdriveCore}-LogGroup
  LogGroupName: /aws/lambda/us-east-1.lambda_at_edge
  Region: eu-west-1
  RetentionInDays: "90"

```

## Implementation

The implemention of the `loggrp` lambda uses the [AWS Lambda Go](https://github.com/aws/aws-lambda-go) library to simplify the integration. It is run in the `go1.x` runtime.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL