-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Support for fewer rolling files, and shorter time window #19
Comments
Hi Rob. Yes that seems to be a valid problem. I know for a fact that you can specify the number of files the rolling file should retain, but am unsure whether you can control when the files should be rolled. Lets investigate this before proceeding further. |
The rolling file sink gives us the following configuration options:
There doesn't seem to be an option for specifying when a file should be rolled. Would it be acceptable for you to specify the |
I’d be happy with being able to set the pathFormat and retainedFileCountLimit.
Right now it looks like pathFormat is set to bufferBaseFilename + "-{Date}.json"
For me it would be nice to able to pass in my own definition (ie. I’d pass "-{HalfHour}.json")
That would let me customize how long before the files roles over.
Passing retainedFileCountLimit would keep the file count from growing to the full 31, ideally I’d like to be able to clamp the number of files at 4 or 5 to prevent the systems from running low on disk. I’ve been experimenting with fileSizeLimitBytes, it seems to just stop logging when the file reaches the limit. I’d rather have old data role off (even if it hasn’t been moved to logstash) than have current log data missed – so retainedFileCountLimit seems like a better option for me.
From: Mattias Kindborg @FantasticFiasco [mailto:[email protected]]
Sent: Friday, May 19, 2017 8:52 AM
To: FantasticFiasco/serilog-sinks-http <[email protected]>
Cc: Rob Somerville <[email protected]>; Author <[email protected]>
Subject: Re: [FantasticFiasco/serilog-sinks-http] Support for fewer rolling files, and shorter time window (#19)
The rolling file sink gives us the following configuration options:
public static LoggerConfiguration RollingFile(
this LoggerSinkConfiguration sinkConfiguration,
ITextFormatter formatter,
string pathFormat,
LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
long? fileSizeLimitBytes = DefaultFileSizeLimitBytes,
int? retainedFileCountLimit = DefaultRetainedFileCountLimit,
LoggingLevelSwitch levelSwitch = null,
bool buffered = false,
bool shared = false,
TimeSpan? flushToDiskInterval = null)
There doesn't seem to be an option for specifying when a file should be rolled. Would it be acceptable for you to specify the fileSizeLimitBytes instead?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#19 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AMLNki_kFCOGR9D6tHjENkJyaSI8T6GHks5r7bqqgaJpZM4Nf3ZI>.
|
Wow, I didn't even know that the rolling file sink supported What we can do is to replace
If this, in combination with The other solution is to also support a file size based rolling behavior, as implemented by Serilog.Sinks.RollingFileAlternate. But I am hesitant to do so, mainly because Serilog.Sinks.RollingFileAlternate is far from being the battle tested dependency Serilog.Sinks.RollingFile is. |
I agree, I like the more established RollingFile over RollingFileAlternate. bufferFilenameFormat and retainedFileCountLimit would work well for me.
From: Mattias Kindborg @FantasticFiasco [mailto:[email protected]]
Sent: Friday, May 19, 2017 2:41 PM
To: FantasticFiasco/serilog-sinks-http <[email protected]>
Cc: Rob Somerville <[email protected]>; Author <[email protected]>
Subject: Re: [FantasticFiasco/serilog-sinks-http] Support for fewer rolling files, and shorter time window (#19)
Wow, I didn't even know that the rolling file sink supported {Date}, {Hour} and {HalfHour}. The parameter description of pathFormat only mentioned {Date}. Thanks for informing me!
What we can do is to replace bufferBaseFilename with a new parameter called bufferFilenameFormat, which would allow you to specify the full filename format, letting you decide the rolling period. Here is the description from the rolling file sink:
The sink supports three different filename format specifiers:
- {Date} Creates a file per day. Filenames use the yyyyMMdd format.
- {Hour} Creates a file per hour. Filenames use the yyyyMMddHH format.
- {HalfHour} Creates a file per half hour. Filenames use the yyyyMMddHHmm format.
If a log file path is provided without one of the specifiers above, {Date} will be inserted by default.
If this, in combination with retainedFileCountLimit is acceptable to you, I think we should go for that solution.
The other solution is to also support a file size based rolling behavior, as implemented by Serilog.Sinks.RollingFileAlternate<https://github.com/BedeGaming/sinks-rollingfile>. But I am hesitant to do so, mainly because Serilog.Sinks.RollingFileAlternate is far from being the battle tested dependency Serilog.Sinks.RollingFile is.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#19 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AMLNkk9-s0TALiImTYpCvD-PKAZyt346ks5r7gxVgaJpZM4Nf3ZI>.
|
Is this something you would like to contribute? Otherwise I'll get right on it. |
I’d be happy to submit a pull request.
From: Mattias Kindborg @FantasticFiasco [mailto:[email protected]]
Sent: Saturday, May 20, 2017 1:53 AM
To: FantasticFiasco/serilog-sinks-http <[email protected]>
Cc: Rob Somerville <[email protected]>; Author <[email protected]>
Subject: Re: [FantasticFiasco/serilog-sinks-http] Support for fewer rolling files, and shorter time window (#19)
Is this something you would like to contribute? Otherwise I'll get right on it.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#19 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AMLNkvfP7zkNYmcvj1gzGdokciYCHOe3ks5r7qoDgaJpZM4Nf3ZI>.
|
I have a PR, but I'm getting a 403 when I try and create the branch. Is that permissions on the repo? I can send a zip if you'd rather. |
Could that be because you've cloned this repository and try to commit to it? If so, try to create a fork, commit your changes (just copy the files with changes over to the forked repository) and create the PR from your fork. Please let me know if I can help you along the way. |
You can find a 4.0.0 beta release on NuGet if you would like to try it out. I'll make an official release in two days if nothing unexpected occurs. Thanks for improving the functionality and compatibility of this sink. |
Thanks, it’s much appreciated, we’ll try it out.
From: Mattias Kindborg @FantasticFiasco [mailto:[email protected]]
Sent: Tuesday, June 6, 2017 2:00 PM
To: FantasticFiasco/serilog-sinks-http <[email protected]>
Cc: Rob Somerville <[email protected]>; Author <[email protected]>
Subject: Re: [FantasticFiasco/serilog-sinks-http] Support for fewer rolling files, and shorter time window (#19)
You can find a 4.0.0 beta release on NuGet if you would like to try it out. I'll make an official release in two days if nothing unexpected occurs.
Thanks for improving the functionality and compatibility of this sink.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<#19 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AMLNkk4jMKzks_RySGCGbmDGlyN5hRtqks5sBb3mgaJpZM4Nf3ZI>.
|
Added - [BREAKING CHANGE] Support for Serilog.Settings.Configuration required changing the extension methods configuring a HTTP sink. 'Options' and 'DurableOptions' no longer exist, and their properties are now optional parameters on the extension methods instead. - Support for HTTP body configuration using 'IBatchFormatter' and 'ITextFormatter'. This enables full control of how messages are serialized before being sent over the network. (contribution by @kvpt) - Support for specifying the maximum number of retained buffer files and their rotation period on the durable HTTP sink. (contribution by @rob-somerville) Fixes #8 Fixes #11 Fixes #19
Any news on this? |
Added - [BREAKING CHANGE] Support for Serilog.Settings.Configuration required changing the extension methods configuring a HTTP sink. 'Options' and 'DurableOptions' no longer exist, and their properties are now optional parameters on the extension methods instead. - Support for HTTP body configuration using 'IBatchFormatter' and 'ITextFormatter'. This enables full control of how messages are serialized before being sent over the network. (contribution by @kvpt) - Support for specifying the maximum number of retained buffer files and their rotation period on the durable HTTP sink. (contribution by @rob-somerville) Fixes #8 Fixes #11 Fixes #19
We're logging audit data at a high rate. The RollingFileSink in the DurableHttpSink is creating a new log file once a day, and keeping 31 logs. We'd like to move to a model where log files are created every 30 minutes, and only the last three are retained. Do you think this could be made a configuration option? Should I submit a pull request?
The text was updated successfully, but these errors were encountered: