Skip to content

Instantly share code, notes, and snippets.

View LuisRojas-LetsWarp's full-sized avatar

Luis Rojas LuisRojas-LetsWarp

View GitHub Profile
@adam-hanna
adam-hanna / systemd-cloudwatch-logs-tutorial.md
Last active June 12, 2024 04:04
Forward systemd service logs to AWS Cloudwatch

Introduction

I often find myself ssh'ing into my servers and checking my systemd service logs with $ journalctl -f -u {name}.service. One day I got tired of this and wanted all of my important logs in once place (Amazon AWS Cloudwatch). To my dismay, there weren't any real good tutorials on how to do so. So, voilà.

Steps

Overall, it's a fairly simple process consisting of the following few steps.

1. Modify the service file

Open the service file with $ sudo vi /lib/systemd/system/{name}.service

Modify the [Service] section: