[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 771
  • Last Modified:

Batch file - DNS debugging log Backup

We have enabled dns debugging logs with 500 MB, now i have increased the value to maximum limit of 1 GB.
Here issue is the file gets overwritten once it reach the 1 GB limit.
We have a requirement to have the Backup for 7 days, which will have for Sunday to Saturday.

I want the DNsLog file to be copied to an location once it reaches a limit with Day Date & time.

And files more than 7 days has to be deleted.

Please advices some good ideas and help me for the batch file to achive this target.

Thanks,
Prem
0
Premkumar Yogeswaran
Asked:
Premkumar Yogeswaran
  • 5
  • 3
1 Solution
 
Philip PortnoyCommented:
Why not use powershell?
Only question - if you delete the file, will the new one be created?
If yes - here's something you can do (run it every X minutes, depends on your file growth tempo)

$dnslog = "C:\Path\To\Your\Log.log"
$backuppath = "\\path\to\backup\share\"
$filename = "DNSbackup_" + (Get-Date -UFormat "%Y_%m_%d_%H%M%S").ToString()

if ((Get-Item $dnslog).length -gt 900mb) {
 Move-Item $dnslog -Destination $filename -Force
}

Open in new window


There might be some syntax errors, but you got the whole idea?
0
 
Premkumar YogeswaranAuthor Commented:
We dont have powershell in our domain controllers. Its 2003 servers.
Please could you check for batch file or script.

Thanks,
0
 
Philip PortnoyCommented:
I'm sorry, but what's the problem in installing PowerShell?
It's included into all the latest Windows Updates.
I recommend to keep your systems up-to-date.

You need to have Server 2003 SP2.
Here're the links for powershell:

x86: http://www.microsoft.com/downloads/details.aspx?FamilyId=f002462b-c8f2-417a-92a3-287f5f81407e
x64: http://www.microsoft.com/downloads/details.aspx?FamilyId=909bbcf1-bd78-4e03-8c83-69434717e551
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
Premkumar YogeswaranAuthor Commented:
Hi philip,
Thanks for your suggestion. I will check to have PowerShell installed. But still it will take process for approval and change management.

So, we would currently check for Batch Scripting. So we can configure a scheduled task to check the same in timely manner.

Thanks,
0
 
Philip PortnoyCommented:
Unfortunately I'm very bad with VBS, but you have the PowerShell example, so you can easily convert. Just use robocopy instead of Move-Item.
0
 
Premkumar YogeswaranAuthor Commented:
We have planned to install powershell in Domain Controllers. will install and update you..
0
 
Premkumar YogeswaranAuthor Commented:
Hi Philip,

I have installed powershell in servers. Now before checking your script, we need to decide the scheduled task time interval.

For that, i need to check the file size increasing time frame.

Could you help me to provide a script which will give the output in an notepad and it has to be appended.

Output Format:
Date / Time   | File Path    | File Size in MB

Thanks
0
 
Premkumar YogeswaranAuthor Commented:
Hi Philip,

i have created an scheduled task for 15 mins and it is running good...
here it is copying 6 files per day, which is 6 GB per day.

Could you help in another script for the same task for the scenario below

DNSbackup_2014_07_28_143100.log -> this is the log file generated by the script.
i need to filter 5 days old files based on the file name (DNSbackup_*) in that folder and delete those files.

Thanks,
0

Featured Post

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now