Skip to content

Commit

Permalink
Use DevX logs instead of kinesis-logback-appender
Browse files Browse the repository at this point in the history
This decouples the application from the logging, which avoids the application falling over if there is ever an issue pushing logging events to kinesis
  • Loading branch information
davidfurey committed Dec 13, 2023
1 parent e27f442 commit f7ab2a6
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 48 deletions.
2 changes: 0 additions & 2 deletions app/AppLoader.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import modules.LogShipping
import play.api.ApplicationLoader.Context
import play.api.{Application, ApplicationLoader, LoggerConfigurator}
import services.Config
Expand All @@ -9,7 +8,6 @@ class AppLoader extends ApplicationLoader {
LoggerConfigurator(context.environment.classLoader).foreach {
_.configure(context.environment)
}
new LogShipping()

new AppComponents(context, Config()).application
}
Expand Down
44 changes: 0 additions & 44 deletions app/modules/LogShipping.scala

This file was deleted.

1 change: 0 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ lazy val dependencies = Seq(
"com.gu" %% "content-api-client-default" % "17.24.1",
"com.gu" %% "tags-thrift-schema" % "2.8.1",
"net.logstash.logback" % "logstash-logback-encoder" % "7.2",
"com.gu" % "kinesis-logback-appender" % "1.0.5",
"org.slf4j" % "slf4j-api" % "1.7.12",
"org.slf4j" % "jcl-over-slf4j" % "1.7.12",
"com.gu" %% "panda-hmac-play_2-8" % "2.0.1",
Expand Down
29 changes: 29 additions & 0 deletions cloudformation/tag-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ Parameters:
Description: The ARN of the SNS topic to notify when an alarm occurs
Type: AWS::SSM::Parameter::Value<String>
Default: /account/services/alert.topic.arn
LoggingStreamName:
Type: AWS::SSM::Parameter::Value<String>
Description: Name of the kinesis stream for logging to ELK (logs.gutools)
Default: /account/services/logging.stream.name
LoggingStreamArn:
Type: AWS::SSM::Parameter::Value<String>
Description: ARN of the kinesis stream for logging to ELK (logs.gutools)
Default: /account/services/logging.stream
Conditions:
IsProd: !Equals [!Ref Stage, PROD]
Mappings:
Expand Down Expand Up @@ -195,6 +203,21 @@ Resources:
Resource: '*'
Roles:
- !Ref 'TagManagerRole'
LogServerPolicy:
Type: AWS::IAM::Policy
Properties:
PolicyName: LogServerPolicy
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action:
- kinesis:PutRecord
- kinesis:PutRecords
- kinesis:DescribeStream
Resource: !Ref LoggingStreamArn
Roles:
- !Ref 'TagManagerRole'
TagManagerInstanceProfile:
Type: AWS::IAM::InstanceProfile
Properties:
Expand Down Expand Up @@ -280,6 +303,12 @@ Resources:
- Key: App
Value: tag-manager
PropagateAtLaunch: 'true'
- Key: LogKinesisStreamName
Value: !Ref 'LoggingStreamName'
PropagateAtLaunch: 'true'
- Key: SystemdUnit
Value: tag-manager.service
PropagateAtLaunch: 'true'
TagManagerLaunchConfig:
Type: AWS::AutoScaling::LaunchConfiguration
Properties:
Expand Down
2 changes: 1 addition & 1 deletion riff-raff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ deployments:
parameters:
amiTags:
BuiltBy: amigo
Recipe: editorial-tools-focal-java8-ARM
Recipe: editorial-tools-focal-java8-ARM-WITH-cdk-base
AmigoStage: PROD
amiEncrypted: true
prependStackToCloudFormationStackName: false
Expand Down

0 comments on commit f7ab2a6

Please sign in to comment.