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

Enable OCIS to log to a file #1619

Closed
labkode opened this issue Feb 10, 2021 · 5 comments
Closed

Enable OCIS to log to a file #1619

labkode opened this issue Feb 10, 2021 · 5 comments
Labels
Type:Story User Story

Comments

@labkode
Copy link
Member

labkode commented Feb 10, 2021

As per other software (nginx, apache, ...) and to make OCIS deployment more dev/admin friendly,
OCIS should have an option to log to a file.

Zerolog allows for that as we are using in in Reva so it comes out of the box.

Acceptance criteria

  • config option in oCIS that will configure log output for all services, defaults to stdout
  • config option in individual services to override the global option
  • unit test for config option (don't test the logger :-P)
@butonic
Copy link
Member

butonic commented Feb 10, 2021

I don't think we should implement logging to a file. logging to stdout/stderr is already handled out of the box by docker and systemd.

When starting it as a systemd unit stdout logging is already taken care of, see http://0pointer.de/blog/projects/journalctl.html

[...] the journal is a component of systemd, that captures Syslog messages, Kernel log messages, initial RAM disk and early boot messages as well as messages written to STDOUT/STDERR of all services, indexes them and makes this available to the user. It can be used in parallel, or in place of a traditional syslog daemon, such as rsyslog or syslog-ng. [...]

The official docker containers for nginx and apache even redirect their logfiles to stdout to let docker capture them, see https://docs.docker.com/config/containers/logging/

Logfiles seem to be a step back, don't they?

@labkode
Copy link
Member Author

labkode commented Feb 11, 2021

Let me explain you the workflow we have for logs:

Our daemons create log files that are stored in the local filesystem for a period of time (3 months).
A fluentd agent tails the logs file and ships them to a centralized sink for post-processing and ultimately to ES/InfluxDB.

By having OCIS not having the possibility to write to a file when technically is possible, means that we need to configure another dependency (rsyslog or systemd) to accomplish that. Less external dependencies the better, etcd is also another one part of the picture.

I thought to the goal was to run OCIS of the box, but this is currently not possible as many core functionalities are delegated to external services.

@wkloucek
Copy link
Contributor

wkloucek commented Mar 8, 2021

@exalate-issue-sync
Copy link

Alex Unger commented: pr exists here: #1816

@exalate-issue-sync
Copy link

Alex Unger commented: OCIS File Logging

Design Choices:

  • if the file does not exist, the command aborts and exits with status 1.
  • Pretty logs are only available in the console.
  • When running with pretty logs, writing to file is disabled.

Use Cases

  • start default runtime extensions: OCIS_LOG_FILE=/Users/foo/bar/ocis OCIS_LOG_PRETTY=true OCIS_LOG_COLOR=true bin/ocis server
    • every default extension log is written to foo/bar/ocis.log.
  • start an extension using the single binary redirecting log output to a dedicated log file: OCIS_LOG_FILE=/Users/foo/bar/proxy.log OCIS_LOG_PRETTY=true OCIS_LOG_COLOR=true bin/ocis proxy
    • all logs only for the proxy extension are written to foo/bar/proxy.log.
  • start an extension without the single binary: PROXY_LOG_FILE=/Users/foo/bar/proxy.log go run cmd/proxy/main.go server
    • all logs only for the proxy extension are written to foo/bar/proxy.log.
  • start an extension with ocis run proxy
    • not yet supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type:Story User Story
Projects
None yet
Development

No branches or pull requests

3 participants