Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/release-template-files.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ on:
push:
branches:
- main
paths:
- '*.yaml'

jobs:
build-and-deploy:
Expand Down Expand Up @@ -43,6 +41,17 @@ jobs:
- name: Verify the changes
run: cat lambda-template.yaml

# Update the LambdaInstrumentationVersion in lambda-template.yaml
- name: Update LambdaInstrumentationVersion in lambda-template.yaml
run: |
# Extract the version from version.go
version=$(grep 'const InstrumentationVersion' src/common/version.go | awk -F '"' '{print $2}')
echo "Extracted version: $version"

# Replace the version in lambda-template.yaml
sed -i "s/LambdaInstrumentationVersion: [^ ]*/LambdaInstrumentationVersion: $version/" lambda-template.yaml
cat lambda-template.yaml
Comment thread
hrai-nr marked this conversation as resolved.

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v3
with:
Expand Down
52 changes: 49 additions & 3 deletions lambda-template.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
AWSTemplateFormatVersion: "2010-09-09"
Transform: AWS::Serverless-2016-10-31
Description: New Relic Template to forward logs using S3 bucket and/or cloudwatch using lambda

Mappings:
VersionMap:
MetricsForwarder:
LambdaInstrumentationVersion: 1.0.0 #This will be dynamially updated by release workflow
Metadata:
AWS::ServerlessRepo::Application:
Name: NewRelic-log-forwarding
Expand Down Expand Up @@ -30,7 +33,9 @@ Metadata:
default: 'Common Attributes to be added to the log events'
StoreNRLicenseKeyInSecretManager:
default: 'Store New Relic License Key in AWS Secrets Manager'

MonitoringTier:
default: 'Metrics Monitoring Collection Tier'

Parameters:
LicenseKey:
Type: String
Expand Down Expand Up @@ -68,13 +73,27 @@ Parameters:
Default: "true"
AllowedValues:
- "true"
- "false"
- "false"
MonitoringTier:
Type: String
Description: |
Determines the metrics collection frequency and detail level for Lambda Log Forwarder
- None: Send No metrics
- Basic: Limited metrics every 15 minutes
- Advanced: Full metrics every 5 minutes
Default: "Basic"
AllowedValues:
- "None"
- "Basic"
- "Advanced"


Conditions:
ShouldCreateSecret: !Equals [ !Ref StoreNRLicenseKeyInSecretManager, "true" ]
AddS3Trigger: !Not [ !Equals [!Ref S3BucketNames , ""]]
AddCloudwatchTrigger: !Not [ !Equals [!Ref LogGroupConfig , ""]]
IsCommonAttributesNotBlank: !Not [!Equals [!Ref CommonAttributes, ""]]
EnableMetricsForwarder: !Not [ !Equals [!Ref MonitoringTier, "None"]]

Resources:
NewRelicLogsLicenseKeySecret:
Expand Down Expand Up @@ -453,6 +472,33 @@ Resources:
LambdaFunctionArn: !GetAtt NewRelicLogsServerlessLogForwarder.Arn
InvalidLogGroups: !GetAtt NewRelicLogsResourceForLogGroupArnConstruction.InvalidLogGroups

NewRelicMetricsForwarderTrigger:
Type: 'AWS::CloudFormation::Stack'
Condition: EnableMetricsForwarder
Properties:
TemplateURL: https://s3.us-east-2.amazonaws.com/unified-lambda-serverless/logging-metrics-template.yaml
Parameters:
LicenseKey: !Ref LicenseKey
LicenseKeySecretArn: !If
- ShouldCreateSecret
- !Ref NewRelicLogsLicenseKeySecret
- ""
NewRelicRegion: !Ref NewRelicRegion
NewRelicAccountId: !Ref NewRelicAccountId
StoreNRLicenseKeyInSecretManager: !Ref StoreNRLicenseKeyInSecretManager
MonitoringTier: !Ref MonitoringTier
LogForwarderLambdaInputJSON:
Fn::Sub:
- |
[
{
"Arn": "${NewRelicLogsServerlessLogForwarder.Arn}",
"InstrumentationVersion": "${lambda_instrumentation_version}"
}
]
- lambda_instrumentation_version: !FindInMap [VersionMap, MetricsForwarder, LambdaInstrumentationVersion]
LogForwarderFirehoseInputJSON: ""

Outputs:
NewRelicLogsLambdaFunctionArn:
Description: The ARN of the Lambda function.
Expand Down
18 changes: 17 additions & 1 deletion logging-firehose-metric-polling.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Metadata:
- LoggingS3BackupBucketName
- EnableCloudWatchLoggingForFirehose
- StoreNRLicenseKeyInSecretManager
- MonitoringTier

ParameterLabels:
IntegrationName:
Expand All @@ -65,7 +66,9 @@ Metadata:
CommonAttributes:
default: 'Common Attributes to be added to the log events'
StoreNRLicenseKeyInSecretManager:
default: 'Store New Relic License Key in AWS Secrets Manager'
default: 'Store New Relic License Key in AWS Secrets Manager'
MonitoringTier:
default: 'Metrics Monitoring Collection Tier'

Parameters:
IAMRoleName:
Expand Down Expand Up @@ -144,6 +147,18 @@ Parameters:
AllowedValues:
- "true"
- "false"
MonitoringTier:
Type: String
Description: |
Determines the metrics collection frequency and detail level for Firehose Log Forwarder
- None: Send No metrics
- Basic: Limited metrics every 15 minutes
- Advanced: Full metrics every 5 minutes
Default: "Basic"
AllowedValues:
- "None"
- "Basic"
- "Advanced"

Resources:
NewRelicLogsFirehose:
Expand All @@ -160,6 +175,7 @@ Resources:
EnableCloudWatchLoggingForFirehose: !Ref EnableCloudWatchLoggingForFirehose
CommonAttributes: !Ref CommonAttributes
StoreNRLicenseKeyInSecretManager: !Ref StoreNRLicenseKeyInSecretManager
MonitoringTier: !Ref MonitoringTier

# New Relic Metrics Polling Stack
NewrelicMetricsPollingStack:
Expand Down
16 changes: 16 additions & 0 deletions logging-firehose-metric-stream.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Metadata:
- LoggingS3BackupBucketName
- EnableCloudWatchLoggingForFirehose
- StoreNRLicenseKeyInSecretManager
- MonitoringTier
-
Label:
default: 'AWS Config Service Configuration (Optional)'
Expand Down Expand Up @@ -88,6 +89,8 @@ Metadata:
default: 'Common Attributes to be added to the log events'
StoreNRLicenseKeyInSecretManager:
default: 'Store New Relic License Key in AWS Secrets Manager'
MonitoringTier:
default: 'Metrics Monitoring Collection Tier'

Parameters:
IAMRoleName:
Expand Down Expand Up @@ -206,6 +209,18 @@ Parameters:
AllowedValues:
- "true"
- "false"
MonitoringTier:
Type: String
Description: |
Determines the metrics collection frequency and detail level for Firehose Log Forwarder
- None: Send No metrics
- Basic: Limited metrics every 15 minutes
- Advanced: Full metrics every 5 minutes
Default: "Basic"
AllowedValues:
- "None"
- "Basic"
- "Advanced"

Resources:
NewRelicLogsFirehose:
Expand All @@ -222,6 +237,7 @@ Resources:
EnableCloudWatchLoggingForFirehose: !Ref EnableCloudWatchLoggingForFirehose
CommonAttributes: !Ref CommonAttributes
StoreNRLicenseKeyInSecretManager: !Ref StoreNRLicenseKeyInSecretManager
MonitoringTier: !Ref MonitoringTier

# New Relic Metrics Stack
NewrelicMetricsStack:
Expand Down
20 changes: 18 additions & 2 deletions logging-lambda-firehose-metric-polling.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ Metadata:
- LoggingFirehoseStreamName
- LoggingS3BackupBucketName
- EnableCloudWatchLoggingForFirehose
- StoreNRLicenseKeyInSecretManager
- StoreNRLicenseKeyInSecretManager
- MonitoringTier

ParameterLabels:
IntegrationName:
Expand Down Expand Up @@ -69,6 +70,8 @@ Metadata:
default: 'Enables CloudWatch logging for Logging Firehose stream'
StoreNRLicenseKeyInSecretManager:
default: 'Store New Relic License Key in AWS Secrets Manager'
MonitoringTier:
default: 'Metrics Monitoring Collection Tier'

Parameters:
IAMRoleName:
Expand Down Expand Up @@ -148,7 +151,19 @@ Parameters:
Default: "true"
AllowedValues:
- "true"
- "false"
- "false"
MonitoringTier:
Type: String
Description: |
Determines the metrics collection frequency and detail level for Log Forwarder:
- None: Send No metrics
- Basic: Limited metrics every 15 minutes
- Advanced: Full metrics every 5 minutes
Default: "Basic"
AllowedValues:
- "None"
- "Basic"
- "Advanced"

Resources:
NewRelicLogsLoggingLambdaFirehose:
Expand All @@ -166,6 +181,7 @@ Resources:
LoggingS3BackupBucketName: !Ref LoggingS3BackupBucketName
EnableCloudWatchLoggingForFirehose: !Ref EnableCloudWatchLoggingForFirehose
StoreNRLicenseKeyInSecretManager: !Ref StoreNRLicenseKeyInSecretManager
MonitoringTier: !Ref MonitoringTier

# New Relic Metrics Polling Stack
NewrelicMetricsPollingStack:
Expand Down
16 changes: 16 additions & 0 deletions logging-lambda-firehose-metric-stream.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Metadata:
- LoggingS3BackupBucketName
- EnableCloudWatchLoggingForFirehose
- StoreNRLicenseKeyInSecretManager
- MonitoringTier
-
Label:
default: 'AWS Config Service Configuration (Optional)'
Expand Down Expand Up @@ -92,6 +93,8 @@ Metadata:
default: 'Enables CloudWatch logging for Logging Firehose stream'
StoreNRLicenseKeyInSecretManager:
default: 'Store New Relic License Key in AWS Secrets Manager'
MonitoringTier:
default: 'Metrics Monitoring Collection Tier'

Parameters:
IAMRoleName:
Expand Down Expand Up @@ -212,6 +215,18 @@ Parameters:
AllowedValues:
- "true"
- "false"
MonitoringTier:
Type: String
Description: |
Determines the metrics collection frequency and detail level for Log Forwarder:
- None: Send No metrics
- Basic: Limited metrics every 15 minutes
- Advanced: Full metrics every 5 minutes
Default: "Basic"
AllowedValues:
- "None"
- "Basic"
- "Advanced"

Resources:
NewRelicLogsLoggingLambdaFirehose:
Expand All @@ -229,6 +244,7 @@ Resources:
LoggingS3BackupBucketName: !Ref LoggingS3BackupBucketName
EnableCloudWatchLoggingForFirehose: !Ref EnableCloudWatchLoggingForFirehose
StoreNRLicenseKeyInSecretManager: !Ref StoreNRLicenseKeyInSecretManager
MonitoringTier: !Ref MonitoringTier

# New Relic Metrics Stack
NewrelicMetricsStack:
Expand Down
22 changes: 19 additions & 3 deletions logging-lambda-firehose-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Metadata:
default: 'Enables CloudWatch logging for Logging Firehose stream'
StoreNRLicenseKeyInSecretManager:
default: 'Store New Relic License Key in AWS Secrets Manager'
MonitoringTier:
default: 'Metrics Monitoring Collection Tier'

Parameters:
LicenseKey:
Expand Down Expand Up @@ -96,7 +98,20 @@ Parameters:
Default: "true"
AllowedValues:
- "true"
- "false"
- "false"
MonitoringTier:
Type: String
Description: |
Determines the metrics collection frequency and detail level for Log Forwarder:
- None: Send No metrics
- Basic: Limited metrics every 15 minutes
- Advanced: Full metrics every 5 minutes
Default: "Basic"
AllowedValues:
- "None"
- "Basic"
- "Advanced"


Resources:

Expand All @@ -112,7 +127,8 @@ Resources:
LogGroupConfig: ""
CommonAttributes: !Ref CommonAttributes
StoreNRLicenseKeyInSecretManager: !Ref StoreNRLicenseKeyInSecretManager

MonitoringTier: !Ref MonitoringTier

NewRelicLogsFirehose:
Type: 'AWS::CloudFormation::Stack'
Properties:
Expand All @@ -127,4 +143,4 @@ Resources:
EnableCloudWatchLoggingForFirehose: !Ref EnableCloudWatchLoggingForFirehose
CommonAttributes: !Ref CommonAttributes
StoreNRLicenseKeyInSecretManager: !Ref StoreNRLicenseKeyInSecretManager

MonitoringTier: !Ref MonitoringTier
18 changes: 17 additions & 1 deletion logging-lambda-metric-polling.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Metadata:
- LogGroupConfig
- CommonAttributes
- StoreNRLicenseKeyInSecretManager
- MonitoringTier

ParameterLabels:
IntegrationName:
Expand All @@ -61,6 +62,8 @@ Metadata:
default: 'Common Attributes to be added to the log events'
StoreNRLicenseKeyInSecretManager:
default: 'Store New Relic License Key in AWS Secrets Manager'
MonitoringTier:
default: 'Metrics Monitoring Collection Tier'

Parameters:
IAMRoleName:
Expand Down Expand Up @@ -118,7 +121,19 @@ Parameters:
Default: "true"
AllowedValues:
- "true"
- "false"
- "false"
MonitoringTier:
Type: String
Description: |
Determines the metrics collection frequency and detail level for Lambda Log Forwarder:
- None: Send No metrics
- Basic: Limited metrics every 15 minutes
- Advanced: Full metrics every 5 minutes
Default: "Basic"
AllowedValues:
- "None"
- "Basic"
- "Advanced"

Resources:
NewRelicLogsLoggingLambda:
Expand All @@ -133,6 +148,7 @@ Resources:
LogGroupConfig : !Ref LogGroupConfig
CommonAttributes : !Ref CommonAttributes
StoreNRLicenseKeyInSecretManager: !Ref StoreNRLicenseKeyInSecretManager
MonitoringTier: !Ref MonitoringTier

# New Relic Metrics Polling Stack
NewrelicMetricsPollingStack:
Expand Down
Loading
Loading