From cd0a3a193d61cac158fb82c14be3cb657eabdc5f Mon Sep 17 00:00:00 2001 From: Maria Shaldibina Date: Thu, 26 Jan 2017 16:07:16 -0800 Subject: [PATCH] Update README.md with accurate config [finishes #137179173] Signed-off-by: Chris Hendrix --- README.md | 38 ++++++++++++++++++++++++-------------- config.go | 5 ----- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 22661d2..9e44183 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ![Black Box Flight Recorder](http://i.imgur.com/sCSNdzU.jpg) -## about +## About Applications often provide only a limited ability to log to syslog and often don't log in a consistent format. I also think that syslog is an operational @@ -12,10 +12,9 @@ concern and the application should not know about where it is logging. Blackbox is an experiment to decouple syslogging from an application without messing about with syslog configuration (which is tricky on BOSH VMs). -Blackbox will tail specified files and forward any new lines to a syslog -server. +Blackbox will tail all files in sub-directories of a specified `source_dir`, and forward any new lines to a syslog server. -## usage +## Usage ``` blackbox -config config.yml @@ -26,20 +25,31 @@ The configuration file schema is as follows: ``` yaml hostname: this-host -destination: - transport: udp - address: logs.example.com:1234 +syslog: + destination: + transport: udp + address: logs.example.com:1234 -sources: - - path: hello.txt - tag: hello + source_dir: /path/to/log-dir ``` -Each file can be sent with a different tag. Currently the priority and facility -are hardcoded to `INFO` and `user`. However, allowing customisation of these -per source would not be difficult. +Consider the case where `log-dir` has the following structure: -## installation +``` +/path/to/log-dir +|-- app1 +| |-- stdout.log +| `-- stderr.log +`-- app2 + |-- foo.log + `-- bar.log +``` + +Any new lines written to `app1/stdout.log` and `app1/stderr.log` get sent to syslog tagged as `app1`, while new lines written to `app2/foo.log` and `app2/bar.log` get sent to syslog tagged as `app2`. + +Currently the priority and facility are hardcoded to `INFO` and `user`. + +## Installation ``` go get -u github.com/concourse/blackbox/cmd/blackbox diff --git a/config.go b/config.go index c6ffb39..11fbab9 100644 --- a/config.go +++ b/config.go @@ -34,11 +34,6 @@ func (d *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error { return nil } -type SyslogSource struct { - Path string `yaml:"path"` - Tag string `yaml:"tag"` -} - type SyslogConfig struct { Destination syslog.Drain `yaml:"destination"` SourceDir string `yaml:"source_dir"`