promtail: Add systemd journal support (#730)
Support for reading systemd journal entries has been added. promtail will look for a job in scrape_configs with a journal key to activate the journal target. If GOOS=linux and CGO_ENABLED=1, promtail will now require libsystemd headers to be available for building. If GOOS is not linux or CGO_ENABLED is not 1, journal support will be unavailable and a log message will be printed warning the user that their config file has journal tailing configured without it being built into promtail. See docs/promtail-examples.md for a concrete example of using journal support. Other structural changes made: 1. Ability for checking if scrape.Config.ServiceDiscoveryConfig is non-zero has been added. This was chosen over making ServiceDiscoveryConfig a pointer as yaml.v2 cannot parse an inline struct into a pointer value. 2. Updated pipeline logger component name to journal_pipeline and file_pipeline for JournalTargetManager and FileTargetManager respectively. 3. The positions file will now store positions as strings instead of integers. Existing positions will be read in properly but written out as strings the next time the positions file is saved. This is done to be able to store the journal cursor, which is a string. The positions API has been updated to support reading in the old integer values and the new string values.
Showing
- .circleci/config.yml 3 additions, 3 deletions.circleci/config.yml
- Gopkg.lock 14 additions, 2 deletionsGopkg.lock
- Gopkg.toml 1 addition, 1 deletionGopkg.toml
- Makefile 3 additions, 2 deletionsMakefile
- build/Dockerfile 3 additions, 3 deletionsbuild/Dockerfile
- docs/promtail-examples.md 68 additions, 3 deletionsdocs/promtail-examples.md
- loki-build-image/Dockerfile 14 additions, 14 deletionsloki-build-image/Dockerfile
- pkg/promtail/positions/positions.go 40 additions, 10 deletionspkg/promtail/positions/positions.go
- pkg/promtail/scrape/scrape.go 21 additions, 0 deletionspkg/promtail/scrape/scrape.go
- pkg/promtail/targets/filetarget.go 1 addition, 11 deletionspkg/promtail/targets/filetarget.go
- pkg/promtail/targets/filetarget_test.go 4 additions, 4 deletionspkg/promtail/targets/filetarget_test.go
- pkg/promtail/targets/filetargetmanager.go 5 additions, 1 deletionpkg/promtail/targets/filetargetmanager.go
- pkg/promtail/targets/journaltarget.go 206 additions, 0 deletionspkg/promtail/targets/journaltarget.go
- pkg/promtail/targets/journaltarget_test.go 112 additions, 0 deletionspkg/promtail/targets/journaltarget_test.go
- pkg/promtail/targets/journaltargetmanager.go 45 additions, 0 deletionspkg/promtail/targets/journaltargetmanager.go
- pkg/promtail/targets/journaltargetmanager_linux.go 96 additions, 0 deletionspkg/promtail/targets/journaltargetmanager_linux.go
- pkg/promtail/targets/manager.go 37 additions, 13 deletionspkg/promtail/targets/manager.go
- pkg/promtail/targets/tailer.go 7 additions, 2 deletionspkg/promtail/targets/tailer.go
- pkg/promtail/targets/target.go 9 additions, 17 deletionspkg/promtail/targets/target.go
- vendor/github.com/coreos/go-systemd/sdjournal/functions.go 66 additions, 0 deletionsvendor/github.com/coreos/go-systemd/sdjournal/functions.go
Loading
Please register or sign in to comment