WIP: Implement logic to send service logs to syslog #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Several of the CF and Diego platform services send logs to the local syslog, tagged as
vcap.*
. . The metron agent from loggregrator configures the local syslog to send the logs to metron so that later can be sent to a centralised logging service.In some cases it is the service application itself who sends the logs to syslog, but it seems to be a common pattern across CF and Diego services to let the service log to stdout/stderr, and redirect that output to local files or syslog using the
logger
command.Not all the services implement this feature, and instead they only log to local files. In order to centralise all the logs, so we will add the logic required to send the logs of the missing services.
We will implement the log to stdout and redirect to
logger
pattern whenever is possible.Implementation in logsearch bosh release
We want to implement the same idea in all the graphite and statsd services.
For that we we add several properties:
<service>.log_to_syslog
. When true, we redirect the stdout and stderr in the ctl script into syslog following the standard vcap pattern, in addition to files.In the case of carbon, in order to get the logs sent to
stdout
, we add the option--debug
.In the case of
graphite-web
, we shell out the Log directives to stream the logs tologger
.How to review?
Enable the
*.log_to_syslog
and deploy. Logs should be sent to syslog.If metron agent is installed locally, the logs will be redirected to metron agent the loggregrator.
Open questions
This PR is open to debate for several open questions:
vcap.*
the most appropriate one? This is not a CF official release. But the generic tag vcap.* might be handy to refer to a service deployed with bosh.tee
andlogger
run asroot
forstatsd
andcarbon
Is that fine?