Skip to content

Commit

Permalink
Merge pull request #505 from guardian/devx-logs
Browse files Browse the repository at this point in the history
Use DevX logs instead of kinesis-logback-appender
  • Loading branch information
davidfurey authored Dec 15, 2023
2 parents e27f442 + 1dc3579 commit 448fd0f
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 54 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
12 changes: 6 additions & 6 deletions conf/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
</appender>

<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%coloredLevel %logger{15} - %message%n%xException{5}</pattern>
</encoder>
<encoder class="net.logstash.logback.encoder.LogstashEncoder" />
</appender>
<appender name="ASYNCSTDOUT" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="STDOUT" />
</appender>

<logger name="controllers" level="DEBUG" />
Expand All @@ -27,7 +28,6 @@

<root level="INFO">
<appender-ref ref="LOGFILE"/>
<!-- uncomment to console log locally -->
<!--<appender-ref ref="STDOUT"/>-->
<appender-ref ref="ASYNCSTDOUT"/>
</root>
</configuration>
</configuration>
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 448fd0f

Please sign in to comment.