diff --git a/app/AppLoader.scala b/app/AppLoader.scala
index c804f8f9..e4afad7e 100644
--- a/app/AppLoader.scala
+++ b/app/AppLoader.scala
@@ -1,11 +1,8 @@
import com.amazonaws.regions.Regions
import conf._
import play.api.{Configuration, _}
-import software.amazon.awssdk.regions.internal.util.EC2MetadataUtils
import utils.{AWSCredentialProviders, Logging}
-import scala.util.Try
-
class AppLoader extends ApplicationLoader with Logging {
def load(context: ApplicationLoader.Context): Application = {
LoggerConfigurator(context.environment.classLoader).foreach {
@@ -34,21 +31,6 @@ class AppLoader extends ApplicationLoader with Logging {
Configuration.empty
)(_.configuration(context.environment.mode).withFallback(_))
- val stream: Option[String] =
- extraConfig.getOptional[String]("LoggingStream")
- stream match {
- case Some(stream) =>
- val maybeInstanceId = Try(EC2MetadataUtils.getInstanceId).toOption
- val loggingContext = Map(
- "buildId" -> prism.BuildInfo.buildNumber
- ) ++ maybeInstanceId.map("instanceId" -> _)
- LogConfiguration.shipping(stream, identity, loggingContext)
- case _ =>
- log.info(
- "Missing stream configuration to enable log shipping to central ELK"
- )
- }
-
log.info(s"Loaded config $extraConfig")
val combinedConfig: Configuration =
diff --git a/app/conf/LogConfiguration.scala b/app/conf/LogConfiguration.scala
deleted file mode 100644
index 89e1c1e5..00000000
--- a/app/conf/LogConfiguration.scala
+++ /dev/null
@@ -1,60 +0,0 @@
-package conf
-
-import ch.qos.logback.classic.spi.ILoggingEvent
-import ch.qos.logback.classic.{Logger => LogbackLogger}
-import com.gu.logback.appender.kinesis.KinesisAppender
-import net.logstash.logback.layout.LogstashLayout
-import org.slf4j.{LoggerFactory, Logger => SLFLogger}
-import play.api.libs.json.Json
-import software.amazon.awssdk.regions.Region
-import utils.AWSCredentialProviders
-
-object LogConfiguration {
-
- private def makeCustomFields(
- config: Identity,
- loggingContext: Map[String, String]
- ): String = {
- Json
- .toJson(
- Map(
- "app" -> config.app,
- "stack" -> config.stack,
- "stage" -> config.stage
- )
- ++ loggingContext
- )
- .toString()
- }
-
- def shipping(
- stream: String,
- config: Identity,
- loggingContext: Map[String, String]
- ) = {
- val bufferSize: Int = 1000
- val region: Region = Region.EU_WEST_1
- val rootLogger: LogbackLogger = LoggerFactory
- .getLogger(SLFLogger.ROOT_LOGGER_NAME)
- .asInstanceOf[LogbackLogger]
- val context = rootLogger.getLoggerContext
- val customFields = makeCustomFields(config, loggingContext)
- val layout = new LogstashLayout
- layout.setContext(context)
- layout.setCustomFields(customFields)
- layout.start()
-
- val appender = new KinesisAppender[ILoggingEvent]
- appender.setBufferSize(bufferSize)
- appender.setRegion(region.id)
- appender.setStreamName(stream)
- appender.setContext(context)
- appender.setLayout(layout)
- appender.setCredentialsProvider(
- AWSCredentialProviders.deployToolsCredentialsProviderChain
- )
- appender.start()
- rootLogger.addAppender(appender)
- rootLogger.info("initialised log shipping")
- }
-}
diff --git a/build.sbt b/build.sbt
index 034e3acd..d94fcfd1 100644
--- a/build.sbt
+++ b/build.sbt
@@ -73,7 +73,6 @@ lazy val root = (project in file("."))
filters,
specs2 % "test",
"net.logstash.logback" % "logstash-logback-encoder" % "7.4" exclude ("com.fasterxml.jackson.core", "jackson-databind"),
- "com.gu" % "kinesis-logback-appender" % "2.1.1",
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.15.3"
),
excludeDependencies ++= Seq(
diff --git a/cdk/lib/__snapshots__/prism-ec2-app.test.ts.snap b/cdk/lib/__snapshots__/prism-ec2-app.test.ts.snap
index 80ad307b..5dc4613f 100644
--- a/cdk/lib/__snapshots__/prism-ec2-app.test.ts.snap
+++ b/cdk/lib/__snapshots__/prism-ec2-app.test.ts.snap
@@ -126,6 +126,11 @@ exports[`The PrismEc2App stack matches the snapshot 1`] = `
"PropagateAtLaunch": true,
"Value": "PROD",
},
+ {
+ "Key": "SystemdUnit",
+ "PropagateAtLaunch": true,
+ "Value": "prism.service",
+ },
],
"TargetGroupARNs": [
{
diff --git a/cdk/lib/prism-ec2-app.ts b/cdk/lib/prism-ec2-app.ts
index ae02dbb5..a5264fa8 100644
--- a/cdk/lib/prism-ec2-app.ts
+++ b/cdk/lib/prism-ec2-app.ts
@@ -30,6 +30,9 @@ export class PrismEc2App extends GuStack {
const pattern = new GuPlayApp(this, {
...PrismEc2App.app,
+ applicationLogging: {
+ enabled: true,
+ },
instanceType: InstanceType.of(InstanceClass.T4G, InstanceSize.MEDIUM),
userData: {
distributable: {
diff --git a/conf/logback.xml b/conf/logback.xml
index f468112c..b004e736 100644
--- a/conf/logback.xml
+++ b/conf/logback.xml
@@ -15,8 +15,13 @@
+
+
+
+
+