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

Support log rotate #886

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

spikeekips
Copy link
Contributor

Github Issue

Resolves #873

Background

In debug mode, SEBAK produces huge log messages including HTTP requests and responses log. Under docker, we can use max-size setting in log driver, but a node can keep the entire log messages, it's the matter of choice.

Solution

There are 2 logs, node log, and HTTP log. Each log will have rotate options,

  • --log-rotate-max-size, --http-log-rotate-max-size: if log file is over, rotate log
  • --log-rotate-max-age, --http-log-rotate-max-age: if log file is over days, rotate log
  • --log-rotate-max-count, --http-log-rotate-max-count: if the number of rotated logs over, remove olds
  • --log-rotate-uncompress, --http-log-rotate-uncompress: compress or not

lib/common/log.go Outdated Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented Dec 21, 2018

Codecov Report

Merging #886 into master will decrease coverage by 0.39%.
The diff coverage is 28.4%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #886     +/-   ##
=========================================
- Coverage   60.42%   60.02%   -0.4%     
=========================================
  Files         153      153             
  Lines       10774    10833     +59     
=========================================
- Hits         6510     6503      -7     
- Misses       3521     3585     +64     
- Partials      743      745      +2
Flag Coverage Δ
#integration_tests_long_term 44.24% <28.4%> (-0.3%) ⬇️
#integration_tests_node 40.25% <28.4%> (-0.19%) ⬇️
#unittests 48.43% <26.13%> (-0.19%) ⬇️
Impacted Files Coverage Δ
lib/common/log.go 3.03% <0%> (-0.55%) ⬇️
cmd/sebak/cmd/run.go 54.56% <32.05%> (-2.97%) ⬇️
lib/sync/fetcher.go 57.5% <0%> (-7.5%) ⬇️
lib/sync/try.go 78.57% <0%> (-7.15%) ⬇️
lib/metrics/sync.go 88.57% <0%> (-5.72%) ⬇️
lib/network/validator_connection_manager.go 84.18% <0%> (-0.8%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e1ae687...cbe6eba. Read the comment docs.

@Geod24
Copy link
Contributor

Geod24 commented Dec 21, 2018

I thought you wanted to use logrorate directly ? At least that's what we discussed in the issue

@spikeekips
Copy link
Contributor Author

@Geod24 Hmm, logrotate utility is one of our options. It can be a simple solution to support a rotating log, but under docker, environment to make logrotate to be working needs some additional efforts. I think the rotating log should be the native feature for considering the various deploying environments.

@Geod24
Copy link
Contributor

Geod24 commented Dec 21, 2018

@spikeekips : What kind of additional effort ? It should be a few (<10) LoC in sebak and a configuration file.

@spikeekips
Copy link
Contributor Author

@Geod24 :) For instance, like these
https://www.google.co.kr/search?q=do+ker+logrotate&ie=UTF-8&oe=UTF-8&hl=en-kr&client=safar . Basicslly docker runs one entrypoint, so the daemon like logrotate should be deployed by task manager in docker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Log rotating HTTP log
3 participants