bosnet / sebak

SEBAK, the next BOScoin Blockchain
https://devteam.blockchainos.org
GNU General Public License v3.0
44 stars 15 forks source link

Support log rotate #886

Open spikeekips opened 5 years ago

spikeekips commented 5 years ago

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,

codecov-io commented 5 years ago

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%) :arrow_down:
#integration_tests_node 40.25% <28.4%> (-0.19%) :arrow_down:
#unittests 48.43% <26.13%> (-0.19%) :arrow_down:
Impacted Files Coverage Δ
lib/common/log.go 3.03% <0%> (-0.55%) :arrow_down:
cmd/sebak/cmd/run.go 54.56% <32.05%> (-2.97%) :arrow_down:
lib/sync/fetcher.go 57.5% <0%> (-7.5%) :arrow_down:
lib/sync/try.go 78.57% <0%> (-7.15%) :arrow_down:
lib/metrics/sync.go 88.57% <0%> (-5.72%) :arrow_down:
lib/network/validator_connection_manager.go 84.18% <0%> (-0.8%) :arrow_down:

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 commented 5 years ago

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

spikeekips commented 5 years ago

@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 commented 5 years ago

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

spikeekips commented 5 years ago

@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.