cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1317
Views
15
Helpful
8
Replies

Logging buffered command

rasmus.elmholt
Level 7
Level 7

Hi

 

I have noticed that every time I change the logging buffered amount on a device the log is cleared.

Is there any way to change the buffer without clearing the log?

 

Router useing Version 15.4(3)M1

1 Accepted Solution

Accepted Solutions

The original post asked about a behavior when the size of the logging buffer is changed. As far as I know there is not any way to change that behavior. When you change the size of the logging buffer then the existing buffer content will be cleared. If you want a way to preserve that content then you would need to copy the content of the current log buffer before changing it.

 

HTH

 

Rick

HTH

Rick

View solution in original post

8 Replies 8

Seb Rupik
VIP Alumni
VIP Alumni

Hi there,

Logging to the internal buffer is FIFO and therefore transient. Don’t rely on the contents always being there. If you want to preserve them, either save the buffer to flash:

 

logging file flash:

 

…or send the output to a syslog server for archive purposes.

However neither of these solutions will store the messages already in the buffer at the point in time they are set up.

 

Cheers,

Seb.

I have logging persistent enabled but with the same outcome.

logging file flash: is not available.

(config)#logging file ?
% Unrecognized command

Apologies, after looking at the command references, logging to file seems to be only available in IOS-XE.

The original post asked about a behavior when the size of the logging buffer is changed. As far as I know there is not any way to change that behavior. When you change the size of the logging buffer then the existing buffer content will be cleared. If you want a way to preserve that content then you would need to copy the content of the current log buffer before changing it.

 

HTH

 

Rick

HTH

Rick

Hello

Just like to add to ricks comments regards saving the logging output  before changing its size.

 

One near way to save it would to use the show and Tee commands together

 

show logging | tee loggingfile.txt

 

This will save the output of the show logging to a file on the flash of the device which from there you could transfer if off at your leasure  


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul

I am glad that our responses have been helpful. Thank you for marking this question as solved. This will help other participants in the community to recognize discussions which have helpful information. I believe that the information in this discussion will be helpful to some other participants.

 

HTH

 

Rick

HTH

Rick

BTW, Paul's suggestion saving using the TEE command is great, however, you might not find this command on older devices. If not, most telnet/console programs have some screen display "logging" feature. I.e. if your does, you might show the syslog and capture the screen output. (NB: setting terminal screen length to 0 can will avoid the need to "paginate" through a lengthly syslog.)

Also keep in mind, between the time you "show" and capture your syslog contents, when you resize it, some syslog data might be lost. That, though, might be avoided if you can send your device's syslog output to an external server too.

BTW, as to why the syslog output is likely cleared, well for starters, consider if you size the syslog smaller than it was. In such a case, if the new size cannot retain all its current data, data will be lost. Second, although programmatically, output might be retained when the syslog size is changed, it's generally easier to just drop the current memory allocation and resize it (also likely better since, as far as I know, IOS doesn't use a memory garbage collector). Lastly, as the (buffer) syslog uses a circular buffer, and older syslog data is routinely lost from it, the thinking might also be, if you want a more permanent recording of syslog data, it should be directed to an external log server.

Hi Joseph

Thank you for the answer.
I reconfigured it all using ansible so before I change the values I just saved the output of show logging to a file.
Review Cisco Networking products for a $25 gift card