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

Beats log files should be generated with timestamped filenames #24572

Open
cruscio opened this issue Mar 16, 2021 · 9 comments
Open

Beats log files should be generated with timestamped filenames #24572

cruscio opened this issue Mar 16, 2021 · 9 comments
Labels

Comments

@cruscio
Copy link

cruscio commented Mar 16, 2021

FileBeat's own logging mechanism doesn't support the file logging convention recommended in its documentation. Beat logging should have an option to generate log files with timestamped names when keepfiles is greater than zero.

More about log rotation on Windows

On Windows, log rotation schemes that delete old files and rename newer files to old filenames might get blocked if the old files are being processed by Filebeat. This happens because Windows does not delete files and file metadata until the last process has closed the file. Unlike most *nix filesystems, a Windows filename cannot be reused until all processes accessing the file have closed the deleted file.

To avoid this problem, use dates in rotated filenames. The file will never be renamed to an older filename, and the log writer and log rotator will always be able to open the file. This approach also highly reduces the chance of log writing, rotation, and collection interfering with each other.

Ref:
https://www.elastic.co/guide/en/beats/filebeat/current/configuration-logging.html
https://www.elastic.co/guide/en/beats/filebeat/current/file-log-rotation.html#log-rotation-windows

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Mar 16, 2021
@ycombinator ycombinator added the Team:Elastic-Agent Label for the Agent team label Mar 16, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/agent (Team:Agent)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Mar 16, 2021
@seadub
Copy link

seadub commented May 13, 2021

+1. Would prefer to have a daily rotation for maintenance purposes. filebeat.${yyyy-mm-dd}.log would be ideal.

@botelastic
Copy link

botelastic bot commented May 13, 2022

Hi!
We just realized that we haven't looked into this issue in a while. We're sorry!

We're labeling this issue as Stale to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1.
Thank you for your contribution!

@botelastic botelastic bot added the Stalled label May 13, 2022
@cruscio
Copy link
Author

cruscio commented May 13, 2022

Still relevant - Doesn't look like it's changed in the latest release (8.2 currently)
https://www.elastic.co/guide/en/beats/winlogbeat/current/configuration-logging.html

@botelastic botelastic bot removed the Stalled label May 13, 2022
@kvch
Copy link
Contributor

kvch commented Jun 7, 2022

The documentation seems out of date. In the breaking changes log, you can see that we modified the name of the logs every Beat writes to:

Remove logging.files.suffix option, and default to datetime endings in log file names. The format of the new name is {beatname}-{date}(-n)?.ndjson. Example log file names from oldest to newest: filebeat-20200101.ndjson, filebeat-20200101-1.ndjson, filebeat-20200101-2.ndjson. 28927

Ref: https://www.elastic.co/guide/en/beats/libbeat/current/release-notes-8.0.0.html#_breaking_changes_3

@kvch kvch added the needs_docs label Jun 7, 2022
@botelastic
Copy link

botelastic bot commented Jun 7, 2023

Hi!
We just realized that we haven't looked into this issue in a while. We're sorry!

We're labeling this issue as Stale to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1.
Thank you for your contribution!

@botelastic botelastic bot added the Stalled label Jun 7, 2023
@cruscio
Copy link
Author

cruscio commented Jun 7, 2023

👍

@botelastic botelastic bot removed the Stalled label Jun 7, 2023
@botelastic
Copy link

botelastic bot commented Jun 6, 2024

Hi!
We just realized that we haven't looked into this issue in a while. We're sorry!

We're labeling this issue as Stale to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1.
Thank you for your contribution!

@botelastic botelastic bot added the Stalled label Jun 6, 2024
@cruscio
Copy link
Author

cruscio commented Jun 6, 2024

👍 😑

@botelastic botelastic bot removed the Stalled label Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants