Reputation: 687
I have configured the Nlog file to archive the file daily with max limit of 10000000 Byte. Max Archive file count is 200. Once max limit is reached, old file is being deleted from archive folder. I want to keep older logs (for 4-5 month) some where else on network so do not want to delete it after max archive instead want to move it.
<target name="file" xsi:type="Iit.AsyncWrapper">
<target type="File"
archiveAboveSize="10000000"
archiveEvery="Day"
maxArchiveFiles="200"
archiveNumbering="Rolling"
archiveFileName = "${logDirectory}/archive/log.{#####}.txt"
fileName="${logDirectory}/log.txt"
layout="${longdate}|${level}|${processid}|${threadid}|${message}"
concurrentWrites="false"
keepFileOpen="true"
encoding="iso-8859-2" />
</target>
Once Archive limit is reached, instead of deleting old files, I want to copy the older log file to another location on network. is there a way to achieve the same in nlog? How can I implement this? Any help would be appreciated.
Upvotes: 1
Views: 700
Reputation: 395
Why don't you create a batch file instead of configuring nlog. For this create a batch file to copy new files on network. You can also manage those files to be deleted if older than said days.
Upvotes: 1