Skip to content

PoC for shipping systemd logs to grafana loki

Notifications You must be signed in to change notification settings

mergetb/journaldtail

 
 

Repository files navigation

journaldtail

This is a small PoC to explore how to ship journald logs to grafana loki. This code is currently work in progress.

Any comments and suggestions are welcome.

I made this project since the promtail community is not sure if promtail will support journald. (see: grafana/loki#26 (comment) )

Usage

journaldtail -h
Usage of ./journaldtail:
  -history
    	collect all available logs from beginning of journal
  -server string
    	loki server address (default "http://localhost:3100/api/prom/push")

Building

To build this, you'll need cgo and the systemd headers installed - for example, on a Debian based system, apt-get install libsystemd-dev.

Journal fields

When you import Journald logs to loki, you'll see a large number of log labels. Its worth reading the systemd journal fields documentation to get a feel for what is available to you.

ToDo

  • Fix logging infrastructure in code
  • Enable configuration via flagext
  • Support relabeling config like in promtail
  • Tests
  • Build and release pipeline
  • Documentation
  • Store journald cursor position on disk to allow restart of journaldtail

About

PoC for shipping systemd logs to grafana loki

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 82.0%
  • Makefile 18.0%