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

Log rotation keeps writing to rotated files #60889

Closed
beiske opened this issue Mar 23, 2020 · 5 comments · Fixed by #60956
Closed

Log rotation keeps writing to rotated files #60889

beiske opened this issue Mar 23, 2020 · 5 comments · Fixed by #60956
Labels
blocker bug Fixes for quality problems that affect the customer experience Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:Operations Team label for Operations Team v7.6.2

Comments

@beiske
Copy link
Member

beiske commented Mar 23, 2020

Kibana version: 7.6.0 and 7.6.1

Original install method (e.g. download page, yum, from source, etc.): Elastic Cloud

Describe the bug:

Steps to reproduce:

  1. Start a 7.6 deployment on ESS
  2. Create some traffic to make Kibana chatty in log files
  3. Wait for Kibana to eventually run out of disk space as /app/kibana.log.0 reached 2GB-

Expected behavior:
Rotated files should not go much above the configured size of 10MB

Provide logs and/or server output (if relevant):

ls -lh /app/logs/
total 2.0G
-rw-r--r-- 1 founduser founduser 8.0K Mar 23 09:11 boot.log
-rw-r--r-- 1 founduser founduser 912K Mar 23 09:11 kibana.log
-rw-r--r-- 1 founduser founduser 2.0G Mar 22 17:31 kibana.log.0

Any additional context:

@beiske beiske added the bug Fixes for quality problems that affect the customer experience label Mar 23, 2020
@mshustov mshustov added Team:Operations Team label for Operations Team Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc labels Mar 23, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-platform (Team:Platform)

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-operations (Team:Operations)

@mshustov
Copy link
Contributor

mshustov commented Mar 23, 2020

I see some inconsistencies in rotation behavior.

Kibana rotate files.

  • Set a small threshold for logging.rotate.everyBytes. ~ 150kB - 200kb
logging.verbose: true
logging.dest: "/Users/mikhailshustov/work/kibana/logs/kibana.log"
logging.rotate:
  enabled: true
  everyBytes: 200000
  keepFiles: 5
  • run Kibana with yarn start
  • Kibana generates tons of logs during start and initiate rotation due to this check
    await this._callRotateOnStartup();
  • run ls -lh logs/ and note it contains 2 log files: kibana.log & kibana.log.0. Kibana continue writing to both of them.

Kibana does not rotate files.

  • Set bigger threshold for logging.rotate.everyBytes. ~ 500kB
logging.verbose: true
logging.dest: "/Users/mikhailshustov/work/kibana/logs/kibana.log"
logging.rotate:
  enabled: true
  everyBytes: 500000
  keepFiles: 5
  • run Kibana with yarn start
  • Kibana doesn't rotate on start condition
    await this._callRotateOnStartup();
  • wait for some time and run ls -lh logs/. You can see that kibana.log grows in size and bigger than everyBytes, but rotation is not happening. Although if you run touch logs/kibana.log, Kibana rotates the file and writes logs only to the newly created file.

I expected logging.rotate.usePolling could help to detect the file size changes, but this check prevents the polling mechanism to be used

if (this.usePolling && this.usePolling !== this.config.get('logging.rotate.usePolling')) {
.
Changing code to always use polling logic via usePolling: true
usePolling: this.usePolling,
addresses the issue. But I'm not sure it's the right solution.

@elastic/kibana-operations any ideas what could go wrong? Probably it's not the root of the problem but doesn't allow us to debug it locally.

@mistic
Copy link
Member

mistic commented Mar 23, 2020

@beiske after #60956 getting merged, do u think you could try it with

logging.rotate:
....
  usePolling: true

I believe that would make it work as expected 😃

@mistic mistic reopened this Mar 24, 2020
@mshustov
Copy link
Contributor

done in #60956
backported to
7.x: 192d348
7.6: d23a726

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker bug Fixes for quality problems that affect the customer experience Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Team:Operations Team label for Operations Team v7.6.2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants