DHCP log

Microsoft Windows server 2003
March 26, 2010 at 08:38:52
Specs: Server 2003
I am trying to save all of the DHCP logs from Server 2003 to keep statistics.

Right now I have created a BAT file that runs every night that copies that day's DHCP log to a text file and renames it to the date.

The problem with this is that at the end of the month I have to manually copy and paste all of the text into a master txt file and use Access to pull out all instances of ID 10 or ID 11.

What I need is to be able to just append that day's DHCP log into a master txt file to save myself that manual copy and paste.

How do I do this?

Thanks :)


See More: DHCP log

Report •


#1
March 26, 2010 at 10:11:21
Well ... just append today's file to the master, once a day:

type today_log.log >> master_log.log
del today_log.log

???


Report •

#2
March 26, 2010 at 11:29:00
Thank you!

I had tried that but couldn't make it work. I had neglected to use the ">>"

Issue solved :)


Report •

#3
March 26, 2010 at 11:31:21
Is there a way to not type the first lines: the first lines include the code index of what each code means

"Microsoft DHCP Service Activity Log


Event ID Meaning
00 The log was started.
01 The log was stopped.
02 The log was temporarily paused due to low disk space.
10 A new IP address was leased to a client.
11 A lease was renewed by a client.
12 A lease was released by a client.
13 An IP address was found to be in use on the network.
14 A lease request could not be satisfied because the scope's
address pool was exhausted.
15 A lease was denied.
16 A lease was deleted.
17 A lease was expired.
20 A BOOTP address was leased to a client.
21 A dynamic BOOTP address was leased to a client.
22 A BOOTP request could not be satisfied because the scope's
address pool for BOOTP was exhausted.
23 A BOOTP IP address was deleted after checking to see it was
not in use.
24 IP address cleanup operation has began.
25 IP address cleanup statistics.
30 DNS update request to the named DNS server
31 DNS update failed
32 DNS update successful
50+ Codes above 50 are used for Rogue Server Detection information.

ID,Date,Time,Description,IP Address,Host Name,MAC Address"

I don't need all of that and after a month it would add to a lot of extra lines in the master log.

Thank you again!


Report •

Related Solutions

#4
March 26, 2010 at 16:23:15
can you give a sample of the "actual data" part of the file?
you might be able to use "find" to filter out all the actual data from the prequel. Also you might look into whatever is generating the log and see if there's a "non-verbose" type of switch or setting - what command generates the dhcp log?
And, if all you want is ids 10 and 11, you could maybe combine this as your filter:
findstr < file.txt "10 " "11 " >> eomonth.log
something along that line...

Report •

#5
March 27, 2010 at 14:27:10
Below is a copy of one of the daily log files:

Microsoft DHCP Service Activity Log


Event ID Meaning
00 The log was started.
01 The log was stopped.
02 The log was temporarily paused due to low disk space.
10 A new IP address was leased to a client.
11 A lease was renewed by a client.
12 A lease was released by a client.
13 An IP address was found to be in use on the network.
14 A lease request could not be satisfied because the scope's
address pool was exhausted.
15 A lease was denied.
16 A lease was deleted.
17 A lease was expired.
20 A BOOTP address was leased to a client.
21 A dynamic BOOTP address was leased to a client.
22 A BOOTP request could not be satisfied because the scope's
address pool for BOOTP was exhausted.
23 A BOOTP IP address was deleted after checking to see it was
not in use.
24 IP address cleanup operation has began.
25 IP address cleanup statistics.
30 DNS update request to the named DNS server
31 DNS update failed
32 DNS update successful
50+ Codes above 50 are used for Rogue Server Detection information.

ID,Date,Time,Description,IP Address,Host Name,MAC Address
24,03/26/10,00:00:50,Database Cleanup Begin,,,,
25,03/26/10,00:00:50,0 leases expired and 0 leases deleted,,,,
25,03/26/10,00:00:50,0 leases expired and 0 leases deleted,,,,
24,03/26/10,00:44:07,Database Cleanup Begin,,,,
25,03/26/10,00:44:07,0 leases expired and 0 leases deleted,,,,
25,03/26/10,00:44:07,0 leases expired and 0 leases deleted,,,,
24,03/26/10,01:44:10,Database Cleanup Begin,,,,
25,03/26/10,01:44:10,0 leases expired and 0 leases deleted,,,,
25,03/26/10,01:44:10,0 leases expired and 0 leases deleted,,,,
24,03/26/10,02:44:11,Database Cleanup Begin,,,,
25,03/26/10,02:44:11,0 leases expired and 0 leases deleted,,,,
25,03/26/10,02:44:11,0 leases expired and 0 leases deleted,,,,
24,03/26/10,03:44:11,Database Cleanup Begin,,,,
25,03/26/10,03:44:12,0 leases expired and 0 leases deleted,,,,
25,03/26/10,03:44:12,0 leases expired and 0 leases deleted,,,,
24,03/26/10,04:44:13,Database Cleanup Begin,,,,
25,03/26/10,04:44:13,0 leases expired and 0 leases deleted,,,,
25,03/26/10,04:44:13,0 leases expired and 0 leases deleted,,,,
24,03/26/10,05:44:16,Database Cleanup Begin,,,,
25,03/26/10,05:44:16,0 leases expired and 0 leases deleted,,,,
25,03/26/10,05:44:16,0 leases expired and 0 leases deleted,,,,
24,03/26/10,06:44:19,Database Cleanup Begin,,,,
25,03/26/10,06:44:19,0 leases expired and 0 leases deleted,,,,
25,03/26/10,06:44:19,0 leases expired and 0 leases deleted,,,,
24,03/26/10,07:44:23,Database Cleanup Begin,,,,
25,03/26/10,07:44:23,0 leases expired and 0 leases deleted,,,,
25,03/26/10,07:44:23,0 leases expired and 0 leases deleted,,,,


The above is a direct copy of the first half of the daily log. Windows Server 2003 is set to auto copy that day's DHCP log to another log file and rename the copy to that day's date. Every log file has the same 31 lines at the beginning.

Thank you!


Report •

#6
March 27, 2010 at 22:38:21
i'm still not clear if you're just using the "masterfile" simply as a temporary step to getting the id's 10 and 11, or if the masterfile is used for other purposes.
to obtain only ids 10 & 11:
findstr /r "^10, ^11,"<test >>masterfile
or, if you want the masterfile to hold all of it, and just
get rid of the "prequal" stuff:
findstr /r "^..," <test >> masterfile
althoug this will still pick up this line:
ID,Date,Time,Description,IP Address,Host Name,MAC Address
that could be tuned out as well using reg.exps



Report •


Ask Question