cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

Community Helping Community

306
Views
15
Helpful
8
Replies
Highlighted
Enthusiast

Logging buffered command

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

Everyone's tags (4)
1 ACCEPTED SOLUTION

Accepted Solutions
Hall of Fame Master

Re: Logging buffered command

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

If you found this post helpful, please let the community know by clicking the helpful button!
By doing so, and until end of January, you are helping Doctors Without Borders

View solution in original post

8 REPLIES 8
VIP Advisor

Re: Logging buffered command

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.

Enthusiast

Re: Logging buffered command

I have logging persistent enabled but with the same outcome.

logging file flash: is not available.

(config)#logging file ?
% Unrecognized command
VIP Advisor

Re: Logging buffered command

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

Hall of Fame Master

Re: Logging buffered command

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

If you found this post helpful, please let the community know by clicking the helpful button!
By doing so, and until end of January, you are helping Doctors Without Borders

View solution in original post

VIP Advisor

Re: Logging buffered command

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  



kind regards
Paul

Please rate and mark posts accordingly if you have found any of the information provided useful.
It will hopefully assist others with similar issues in the future
Hall of Fame Master

Re: Logging buffered command

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

If you found this post helpful, please let the community know by clicking the helpful button!
By doing so, and until end of January, you are helping Doctors Without Borders
VIP Expert

Re: Logging buffered command

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.
Enthusiast

Re: Logging buffered command

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.
CreatePlease to create content
Content for Community-Ad
FusionCharts will render here