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

Zipping logs on period basis #3711

Closed
daneel3001 opened this issue Nov 28, 2019 · 4 comments
Closed

Zipping logs on period basis #3711

daneel3001 opened this issue Nov 28, 2019 · 4 comments
Labels
file-archiving Issues with archiving with the file target file-target question

Comments

@daneel3001
Copy link

Hello

I am trying to find the right combination of settings for FileAsyncTarget which will allow me to archive logs in this way:

  • Every Sunday (if weekly archive file), archive existing logs, via archiveEvery
  • Keep log files to around 500KB each, via archiveAboveSize
  • Keep as many as 50 weekly archives, via maxArchiveFiles
  • Archive logs to be zipped using archive file name layout of "archive-{####}.zip", via archiveFileName

Today I am using the following configuration but I don't think it's quite working and it might be due to conflicting settings, specifically archiceAboveSize vs archiveEvery properties.

<target xsi:type="File" encoding="utf-8"
                fileName="${logDirectory}/${fileBaseName}.log"				
                archiveFileName="${logDirectory}/${fileBaseName}.{####}.zip"                
                archiveAboveSize="512000" 
                maxArchiveFiles="50"				
                archiveEvery="Sunday"
                concurrentWrites="false"
				enableArchiveFileCompression="true"
				archiveOldFileOnStartup="false"
                layout="${layout}" />
      </target>

Many thanks in advance

@welcome
Copy link

welcome bot commented Nov 28, 2019

Hi! Thanks for opening your first issue here! Please make sure to follow the issue template - so we could help you better!

@snakefoot
Copy link
Contributor

snakefoot commented Nov 28, 2019

NLog has no such functionality. You need to setup a scheduled-task or cron-job to make the custom zipping-logic happen.

@snakefoot
Copy link
Contributor

snakefoot commented Nov 28, 2019

You are ofcourse welcome to create a pullrequest that resolves #1249 and #2732. Then the file-compression could be extended to perform bulk compression in background. Maybe also look at #4244

@snakefoot snakefoot added file-archiving Issues with archiving with the file target file-target labels Nov 30, 2019
@daneel3001
Copy link
Author

Hello

Ok thanks for letting me know these aren't available at the moment.
I think we will consider the script route as suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
file-archiving Issues with archiving with the file target file-target question
Projects
None yet
Development

No branches or pull requests

2 participants