Skip to content

feat: Switch to devx-logs - #1631

Merged
akash1810 merged 5 commits into
mainfrom
aa/devx-logs
Jan 21, 2026
Merged

feat: Switch to devx-logs#1631
akash1810 merged 5 commits into
mainfrom
aa/devx-logs

Conversation

@akash1810

@akash1810 akash1810 commented Jan 20, 2026

Copy link
Copy Markdown
Member

Note

Easiest to review commit by commit.

What does this change?

This change switches the EC2 services' log shipping from the aws-kinesis-agent to fluentbit via https://github.com/guardian/devx-logs via AMIgo's cdk-base role. This has a few benefits, including:

Note

To enable this, I've created a new recipe in AMIgo as the existing recipe is also used by guardian/mobile-entry, so we can't update it directly.

How to test

  1. Deploy each EC2 service:
  2. Find their logs in Central ELK. Pro-tip devx-logs adds a ShippedBy field to each log, so we can use that to understand which logs come from this change, vs another build.

Footnotes

  1. https://github.com/guardian/mobile-logstash-encoder has a field name of ec2_instance, however devx-logs uses ec2_instance_id. I'm not sure if any dashboards explicitly surface this field, so cannot be certain if the change is an issue.

@github-actions

github-actions Bot commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

https://github.com/guardian/devx-logs requires additional ASG tags
and the `ec2:DescribeInstances` IAM permission.
@github-actions

github-actions Bot commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

@github-actions

github-actions Bot commented Jan 20, 2026

Copy link
Copy Markdown
Contributor

Comment thread notification/conf/logback.xml
https://github.com/guardian/mobile-logstash-encoder hydrates logs with Stack, Stage, App markers
before writing to Kinesis.

This functionality is now covered by https://github.com/guardian/devx-logs so we can remove the dependency.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the docs for a summary of these changes.

amiEncrypted: true
amiTags:
Recipe: mobile-java11-jammy-ARM
Recipe: mobile-java11-jammy-ARM-with-cdk-base

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-with-cdk-base appears to be a convention...

templateStageParameters:
CODE:
SloSqsQueueArn: /notifications/CODE/mobile-notifications/notifications.queues.sloMonitoringArn
LoggingStreamName: /account/services/logging.stream.name.code

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CloudFormation template now has a LoggingStreamName parameter without a default set. This change tells Riff-Raff what value to use when deploying and means the entire change can be deployed with Riff-Raff.

<encoder class="com.gu.mobile.logback.MobileLogstashEncoder">
<defaultAppName>notifications</defaultAppName>
<encoder>
<pattern>%date [%thread] %-5level {%mdc} %logger{36}:%L - %msg%n%xException{15}</pattern>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This format was copied from guardian/prism's.

Comment thread .scala-steward.conf
{ groupId = "com.typesafe.play", artifactId = "sbt-plugin", version = "2.9.1" },

# Pin logstash to 1.8 until we have bumped simple-configuration
{ groupId = "com.gu", artifactId = "mobile-logstash-encoder", version = "1.1.8" },

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This dependency has been removed.

Comment thread build.sbt
"org.postgresql" % "postgresql" % "42.7.7",
"ch.qos.logback" % "logback-core" % logbackVersion,
"ch.qos.logback" % "logback-classic" % logbackVersion,
"net.logstash.logback" % "logstash-logback-encoder" % "8.1"

@akash1810 akash1810 Jan 20, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required to produce JSON formatted logs, as required by fluentbit (via devx-logs). The latest version (9.0) requires Java 17+. We're currently using Java 11.

@akash1810
akash1810 marked this pull request as ready for review January 20, 2026 18:22
@akash1810
akash1810 requested a review from a team as a code owner January 20, 2026 18:22
@akash1810 akash1810 added the feature Departmental tracking: work on a new feature label Jan 21, 2026

@aracho1 aracho1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@akash1810
akash1810 merged commit 0f40810 into main Jan 21, 2026
12 checks passed
@akash1810
akash1810 deleted the aa/devx-logs branch January 21, 2026 12:27
@akash1810

Copy link
Copy Markdown
Member Author

These have all deployed to PROD now. Confirming that logs are appearing:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Departmental tracking: work on a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants