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

Add file rotation based on file age to file output plugin #5547

Conversation

flexd
Copy link
Contributor

@flexd flexd commented Mar 7, 2019

Required for all PRs:

  • Signed CLA.
  • Associated README.md updated.
  • Has appropriate unit tests.
    I have not touched the unit tests at all (yet)

This replaces #3922

@flexd
Copy link
Contributor Author

flexd commented Mar 7, 2019

Err, there we go. Accidentally put in a older file_test.go and broke Write() a bit. This compiles for me, and appears to be working like it should. FYI: It's next to impossible to compile Telegraf with only 2GB ram :-(

@flexd flexd force-pushed the feature-add-file-age-rotation-to-file-output-plugin branch from 1c9954a to 7b55480 Compare March 7, 2019 19:57
@glinton
Copy link
Contributor

glinton commented Mar 7, 2019

Is there any way you can push these changes to the 3922 to preserve the history? Or is this a fundamentally different approach?

@flexd
Copy link
Contributor Author

flexd commented Mar 8, 2019

@glinton uh, I could in theory do that I guess? This is basically rotate.go from the other pull-request with a number of changes and then I added the rotate_max_age field to file.go, in the file plugin.

The other pull-request #3922 adds a whole new plugin rotatingfile that I would have to remove again, with a bunch of reverting commits or a force-push. Also I have deleted the local branch for that, but I guess it would be possible to get that back by pulling it from the pull-request.

Isn't history preserved enough by having the first pull-request saying this one takes over?

Edit: I'd say this is a fundamentally different approach.

@flexd
Copy link
Contributor Author

flexd commented Mar 11, 2019

Does the thumbs up mean everything is good? :-)

@glinton glinton added the feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin label Mar 12, 2019
@glinton glinton added this to the 1.11.0 milestone Mar 12, 2019
This was referenced Apr 28, 2019
@danielnelson
Copy link
Contributor

@flexd We added rotation based on this pull request to the agent logfile, I think we can update this pull request to use the rotating io.Writer now in https://github.com/influxdata/telegraf/tree/master/internal/rotate.

I'd like to include this in the 1.11 release, would you have time to update the pull request?

@flexd
Copy link
Contributor Author

flexd commented May 9, 2019

I will make the required changes :-) Very cool that my pull-request has lead to changes somewhere else!

@flexd
Copy link
Contributor Author

flexd commented May 14, 2019

Uh, that should do it! I think I might have messed up the rebase there with all these commits showing up :-/ Any suggestions?

@danielnelson
Copy link
Contributor

I think you will need to do an interactive rebase git rebase -i master and then remove the unrelated commits keeping only your new changes.

@flexd flexd force-pushed the feature-add-file-age-rotation-to-file-output-plugin branch from 76c196f to cc2fed0 Compare May 15, 2019 05:27
@flexd
Copy link
Contributor Author

flexd commented May 15, 2019

That looks like it fixed it. :-)

plugins/outputs/file/README.md Outdated Show resolved Hide resolved
plugins/outputs/file/file.go Outdated Show resolved Hide resolved
plugins/outputs/file/file.go Outdated Show resolved Hide resolved
@flexd
Copy link
Contributor Author

flexd commented May 17, 2019

That last check was leftover from before the io.MultiWriter was used I think :-) Used to be a slice of writers

@danielnelson danielnelson merged commit 1c0d3a0 into influxdata:master Jun 2, 2019
hwaastad pushed a commit to hwaastad/telegraf that referenced this pull request Jun 13, 2019
bitcharmer pushed a commit to bitcharmer/telegraf that referenced this pull request Oct 18, 2019
athoune pushed a commit to bearstech/telegraf that referenced this pull request Apr 17, 2020
idohalevi pushed a commit to idohalevi/telegraf that referenced this pull request Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants