<div>Hi,</div>
<div> </div>
<div>Which file I have to edit? </div>
<div>I am not getting the last config change for cisco routers.</div>
<div> </div>
<div>Mathy.</div>
<div><br><br> </div>
<div class="gmail_quote">2009/9/25 Iñaki Martinez Diez <span dir="ltr"><<a href="mailto:networking@hostalia.com">networking@hostalia.com</a>></span><br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Hi,<br><br> I want to log the lines:<br><br> ! Last configuration change at 12:50:31 GMT Fri Sep 25 2009 by xxxxx<br>
! NVRAM config last updated at 08:35:27 GMT Fri Sep 25 2009 by xxxxx<br><br><br> But this code is wrong:<br><br>1488 # This routine processes a "write term"<br>1489 sub WriteTerm {<br>1490 print STDERR " In WriteTerm: $_" if ($debug);<br>
1491 my($lineauto,$comment,$linecnt) = (0,0,0);<br>1492<br>1493 while (<INPUT>) {<br>1494 tr/\015//d;<br>1495 last if (/^$prompt/);<br>1496 return(1) if /Line has invalid autocommand /;<br>
1497 return(1) if (/(Invalid input detected|Type help or )/i);<br>1498 return(0) if ($found_end); # Only do this<br>routine once<br>1499 return(-1) if (/command authorization failed/i);<br>
1500 # the pager can not be disabled per-session on the PIX<br>1501 if (/^(<-+ More -+>)/) {<br>1502 my($len) = length($1);<br>1503 s/^$1\s{$len}//;<br>1504 }<br>1505<br>
1506 /Non-Volatile memory is in use/ && return(-1); # NvRAM is<br>locked<br>1507 $linecnt++;<br>1508 $lineauto = 0 if (/^[^ ]/);<br>1509 # skip the crap<br>1510 if (/^(##+$|(Building|Current) configuration)/i) {<br>
1511 while (<INPUT>) {<br>1512 next if (/^Current configuration\s*:/i);<br>1513 next if (/^:/);<br>1514 next if (/^([%!].*|\s*)$/);<br>1515 next if (/^ip add.*ipv4:/); # band-aid for 3620<br>
12.0S<br>1516 last;<br>1517 }<br>1518 if (defined($config_register)) {<br>1519 ProcessHistory("","","","!\nconfig-register<br>$config_register\n");<br>
1520 }<br>1521 tr/\015//d;<br>1522 }<br>1523 # some versions have other crap mixed in with the bits in the<br>1524 # block above<br>1525 /^! (Last configuration|NVRAM config last)/ && next;<br>
1526<br><br> Although i commented the line 1525 the lines above are NEVER logged<br>because the "while" loop in the line 1511 ignore and the two lines are<br>never processed by line 1525, so i made this changes:<br>
<br>1488 # This routine processes a "write term"<br>1489 sub WriteTerm {<br>1490 print STDERR " In WriteTerm: $_" if ($debug);<br>1491 my($lineauto,$comment,$linecnt) = (0,0,0);<br>1492<br>1493 while (<INPUT>) {<br>
1494 tr/\015//d;<br>1495 last if (/^$prompt/);<br>1496 return(1) if /Line has invalid autocommand /;<br>1497 return(1) if (/(Invalid input detected|Type help or )/i);<br>1498 return(0) if ($found_end); # Only do this routine once<br>
1499 return(-1) if (/command authorization failed/i);<br>1500 # the pager can not be disabled per-session on the PIX<br>1501 if (/^(<-+ More -+>)/) {<br>1502 my($len) = length($1);<br>1503 s/^$1\s{$len}//;<br>
1504 }<br>1505<br>1506 /Non-Volatile memory is in use/ && return(-1); # NvRAM is locked<br>1507 $linecnt++;<br>1508 $lineauto = 0 if (/^[^ ]/);<br>1509 # skip the crap<br>1510 if (/^(##+$|(Building|Current) configuration)/i) {<br>
1511 while (<INPUT>) {<br>1512 if (/^! (Last configuration|NVRAM config last)/) {<br>1513 ProcessHistory("","","",$_);<br>1514 next;<br>1515 }<br>
1516 next if (/^Current configuration\s*:/i);<br>1517 next if (/^:/);<br>1518 next if (/^([%!].*|\s*)$/);<br>1519 next if (/^ip add.*ipv4:/); # band-aid for 3620 12.0S<br>1520 last;<br>
1521 }<br>1522 if (defined($config_register)) {<br>1523 ProcessHistory("","","","!\nconfig-register<br>$config_register\n");<br>1524 }<br>1525 tr/\015//d;<br>
1526 }<br>1527 # some versions have other crap mixed in with the bits in the<br>1528 # block above<br>1529<br><br> So now the two lines are logged and emailed.<br><br> I hope this can help somebody.<br><br><br>
_______________________________________________<br>Rancid-discuss mailing list<br><a href="mailto:Rancid-discuss@shrubbery.net">Rancid-discuss@shrubbery.net</a><br><a href="http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss" target="_blank">http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss</a><br>
</blockquote></div><br>