-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Remove logging.files.suffix
option and always use datetime suffixes
#28927
Conversation
This pull request does not have a backport label. Could you fix it @kvch? 🙏
NOTE: |
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
💚 Flaky test reportTests succeeded. 🤖 GitHub commentsTo re-run your PR in the CI, just comment with:
|
This pull request doesn't have a |
logging.files.suffix
option and always use datetime suffixes
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really nice!
@@ -158,7 +147,7 @@ func NewFileRotator(filename string, options ...RotatorOption) (*Rotator, error) | |||
permissions: 0600, | |||
interval: 0, | |||
rotateOnStartup: true, | |||
suffix: SuffixCount, | |||
clock: &realClock{}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
injectible clock makes me happy :-)
/package |
…#28927) ## What does this PR do? This PR contains several improvements to the output file log rotation: * Removes suffix option as discussed offline * Filenames end in extension name so users get a hint about the contents * Removes `time.Sleep` from testing code * Datetime format no longer contains hour and minutes. In case of conflict on rotation, an index is appended to the filename. ## Why is it important? Previously, log file suffixes were configurable. Users had the option to either add the count or the datetime to the end of the log file. From now on, we only allow datetime based naming. Hence the configuration option `logging.files.suffix` is removed. Example: Filebeat is writing logs to `filebeat-20211111.ndjson` actively. Then a few minutes later it gets rotated, and the new active file becomes `filebeat-20211111-1.ndjson`. This change should help with Beats not being able to rotate files on Windows. (cherry picked from commit f2ae281)
…#28927) (#29065) ## What does this PR do? This PR contains several improvements to the output file log rotation: * Removes suffix option as discussed offline * Filenames end in extension name so users get a hint about the contents * Removes `time.Sleep` from testing code * Datetime format no longer contains hour and minutes. In case of conflict on rotation, an index is appended to the filename. ## Why is it important? Previously, log file suffixes were configurable. Users had the option to either add the count or the datetime to the end of the log file. From now on, we only allow datetime based naming. Hence the configuration option `logging.files.suffix` is removed. Example: Filebeat is writing logs to `filebeat-20211111.ndjson` actively. Then a few minutes later it gets rotated, and the new active file becomes `filebeat-20211111-1.ndjson`. This change should help with Beats not being able to rotate files on Windows. (cherry picked from commit f2ae281) Co-authored-by: Noémi Ványi <[email protected]>
…ws-on-file-changes * upstream/master: Fix discovery of Nomad allocations (elastic#28700) Add null (`\u0000`) as a valid line terminator (elastic#28998) Remove `logging.files.suffix` option and always use datetime suffixes (elastic#28927) x-pack/filebeat/module: add note for default var.input (elastic#28324) Fix AccessList & AccessMask processing in security data_stream (elastic#29016) [Metricbeat] Fix wrong mapping on "info" subkey (elastic#28782) ci: daily/weekly jobs (elastic#29050) [mergify] report open backported PRs once a week (elastic#28964)
@kvch The docs and config for the file output appear to not match the new behavior: beats/libbeat/_meta/config/output-file.reference.yml.tmpl Lines 18 to 20 in 3319f5b
beats/libbeat/outputs/fileout/docs/fileout.asciidoc Lines 45 to 48 in 3319f5b
|
Yes, it has been on my TODO list. I've just opened PR: #29501 |
* Follow up changes in the docs for logging * add reference configuration (cherry picked from commit 391a948) Co-authored-by: Noémi Ványi <[email protected]>
This fixes the tests for beats and apm-server when checking for the output files. Relates to changes from elastic/beats#28927
This fixes the tests for beats when checking for the output files. Relates to changes from elastic/beats#28927 Add output ndjson suffix to APM Server output (unclear why this is necessary). * Increase timeout for output file and ensure it is written. The output file is only written when some actual values are processed. Enable self-instrumentation for APM to ensure the output file is written and increase timeout. For beats, enable metrics logging explicitly.
This fixes the tests for beats when checking for the output files. Relates to changes from elastic/beats#28927 Add output ndjson suffix to APM Server output (unclear why this is necessary). * Increase timeout for output file and ensure it is written. The output file is only written when some actual values are processed. Enable self-instrumentation for APM to ensure the output file is written and increase timeout. For beats, enable metrics logging explicitly. * Disable failing beats issues A follow up is necessary to fix and enable these tests if still useful.
What does this PR do?
This PR contains several improvements to the output file log rotation:
time.Sleep
from testing codeWhy is it important?
Previously, log file suffixes were configurable. Users had the option to either add the count or the datetime to the end of the log file. From now on, we only allow datetime based naming. Hence the configuration option
logging.files.suffix
is removed.Example:
Filebeat is writing logs to
filebeat-20211111.ndjson
actively. Then a few minutes later it gets rotated, and the new active file becomesfilebeat-20211111-1.ndjson
.This change should help with Beats not being able to rotate files on Windows.
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.