Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Implement logic to send service logs to syslog #11

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

keymon
Copy link

@keymon keymon commented Sep 16, 2016

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 to logger.

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:

  • Is OK to add a specific property to enable this feature for each service? Shall we use one unique property? or should this be enabled by default?
  • Is the tag 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 and logger run as root for statsd and carbon Is that fine?

When true, we change the invocation of carbon to use --debug in order to
force the daemon to log to stdout, so we can then redirect it to a file
and into syslog following the standard vcap pattern.
When specified as true we will tee to a file and logger with the tag
vcap.graphite-web
Use it to gate the logging via logger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants