In this video lab, you and I are going to do three basic things.
Number one, I'd like to walk you through tweaking the log
messages.
So it's not just a generic message
with limited information.
We can increase it, and I want to walk through how to do that.
Number two, I'd like to change the logging levels based
on the destination, like to the console,
or to monitor, or to the buffer.
We can set those.
I'd like to walk through how to do that.
And while we're at it, let's add the destination
of a syslog server as one of our destinations for log messages.
So we're going to do all this work starting on R1. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
So we're going to do all this work starting on R1.
If you're logged on to the CBT Nuggets website,
click on that link for the virtual lab.
And let's do this together.
So here we are on R1.
And before we start changing everything,
let's go ahead and actually see what is in place.
We'll do a show logging, which is a great place to start.
And here's what the show logging command is revealing.
We are currently logging to line console 0.
We're willing to log at level 7, or debugging,
which from a logging perspective,
debugging is level 7.
There's 6, 5, 4, 3, 2, 1, and 0.
So 8 levels.
So think of it like an umbrella, that wherever WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
So think of it like an umbrella, that wherever
you put the umbrella, if it's all the way here at 7,
it captures everything down below it numerically.
If somebody has an umbrella, it just captures at 3.
It would capture-- it would cover 3 and everything
below it.
So that's the-- debugging is level 7.
We'll take a look at those levels
here closer in just a moment.
We're willing to log to the monitor.
That's VTY lines who are connected also
at the same level and below, and also to the buffer, which
is the memory on the system.
Fantastic.
So if we wanted to change that or disable those, we could. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
So if we wanted to change that or disable those, we could.
Let's go ahead and take a look at exactly how to do that.
Oh, oh!
I'm so excited.
I got ahead of myself.
Before we tweak these, let me share with you
how we can modify the actual log messages themselves.
And let's do a demonstration of what it looks like first.
So do show-- let's go to Configuration mode, config t,
and end.
And here's the log message.
Boom!
Very minor.
Not a lot of detail here.
And that's because for the lab, I usually just strip it away.
And I don't put all the juicy details,
like the date, and time, and year, WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
like the date, and time, and year,
and the millisecond sequence number,
because I just wanted to not clutter up the screen too much.
But for troubleshooting, holy cow, we need it.
So let me walk you through the service timestamp
command for our logged messages and debugs
where we can customize what we want to see.
So we'll go into configuration mode.
And the command is service space timestamps.
And then we can adjust these for log messages,
and also for debug messages.
And you can do it for both.
You can use the same for both if you wanted to.
Let's start off with log.
So we're going to throw the kitchen sink here. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
So we're going to throw the kitchen sink here.
We don't-- uptime, not great.
Uptime shows timers, like how long it's been
since the router's rebooted.
We want dates, and times, and accurate information.
So for production environments, we would include datetime.
And then I'm going to throw the kitchen sink here.
Let's go ahead and use the localtime.
And this is also something-- let's
say you're using NTP, which is delivered in UTC.
And then there's an offset for the local time zone.
So if you've set up for the local time zone correctly
and you're using NTP, that's all very important
if you want to see the correct time.
So I'm doing log datetime localtime. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
So I'm doing log datetime localtime.
Let's include show-timezone.
Let's include year.
Let's include milliseconds.
Now, if we get a whole bunch in rapid succession,
we can say, oh, that one came in a few milliseconds
before the other message.
And let's see if there's any other options.
No.
No, there isn't.
However, I believe there's a service if I can type service.
There is an option for sequence numbers,
which I want to add as well.
So sequence-numbers is just going
to add sequence numbers as well.
So if you weren't looking at milliseconds, WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
So if you weren't looking at milliseconds,
the sequence numbers would help you identify
which one came in first.
So I'm going to throw it on there as well.
And now that we've done that, if we type in end,
check out this log message.
This is great stuff.
I mean, fantastic.
So it's showing us a sequence number here.
That is the date.
That is the time.
That is a message that I'm going to remove off my screen.
There is the lack of the time zone that I've set.
I just took the default settings to set the time zone
on this device.
And then this is the facility, where it's coming from. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
And then this is the facility, where it's coming from.
What's generating this message?
Is it an OSPF process?
Is it that SNMP?
Is it system because somebody just exited configuration mode?
Yes.
And then this is the severity level,
which is a 5, which is notification level.
And then this is also giving us a clue
regarding why it came up.
And it was a configuration-related item.
And then this is some just like text, easy to read,
so we can kind of get a clue on what exactly happened there.
And all these additional details that were not there before
are included now because we did the service timestamp
command for logs. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
command for logs.
And if we wanted to, we could do the same thing
for debug messages as well.
So if we go back into configuration mode
and we hit the Up Arrow key a couple of times,
and we go back to service timestamps,
this time instead of saying for log,
we'll go ahead and say for debug.
That way they'll also be included
in debug messages as well.
Great.
Task number one, tweaking the actual log messages.
Done.
Number two.
Let's tweak the levels that are sent to a given destination.
And we can see our destinations by doing a show logging.
And we currently have console, monitor, and buffer. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
And we currently have console, monitor, and buffer.
So let's do this.
Let's tweak the monitor down to a lower level.
They're all at debugging by default.
Also, when you tweak a level, it also
shows you in the context sensitive help
what those levels are, and also what the associated names are,
which is quite helpful as well.
So let's go to configuration mode.
Let's do a logging.
And let's play with the VTY lines.
Logging monitor, Question Mark, and let's
specify level 3 right here. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
specify level 3 right here.
So level 3 is errors, which will include level 3
and below, numerically below, 3, 2, 1, and 0.
And now if we do a do show logging,
now it's showing us monitor logging.
Think of that like VTY lines.
It's now set at level 3 or the error's level.
So let's test this.
Let's go to type in the end here.
Let me just show ip interface brief.
And let's telnet to this guy.
Now, R2, we should be able to telnet to 1.1.1.1.
Let's go to R2.
I just want to verify via VTY line access WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
I just want to verify via VTY line access
that we're getting the appropriate level of messages
coming back in.
So on router 2, we'll do a telnet to 1.1.1.1.
Password required, but none set.
More troubleshooting.
OK.
Let's do it.
So we'll go back to R1.
And on R1, we'll say show run pipe section line.
So for the line VTY 0 through 4 login.
So there's no password.
Let's tweak it.
Config line vty 0 through 4. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
Config line vty 0 through 4.
And it's going to let it wide open.
No login, meaning no login required.
And we'll do-- while we're at it, privilege level 15, just
to give ourselves a little more easy access.
Excellent.
And then we'll go back to R2.
And we'll connect to 1.1.1.1.
I guess no.
So we'll telnet to 1.1.1.1.
Great.
Now we're at R1.
We'll just show users.
Another command for that is who. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
Another command for that is who.
Same thing.
And we are connected on the VTY line.
So now we do a debug ip packet and press Enter,
we just turned on debugging.
But they're all at level 7.
So we aren't likely to see them here.
Actually, we're not likely to see them here for two reasons.
Let's go back to R1 for a second.
The console, so there's the debug messages.
They're like, rah!
Who turned on that debug?
Let's track that down.
But there's actually a couple of reasons
why we're not seeing it.
Back here at R1-- let's do an un debug all. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
Back here at R1-- let's do an un debug all.
And let's do a show-- let's do a config t, and do show logging.
And let's set the logging back up to like a level 7.
Let's do that.
Set it back to 7.
So logging, monitor, and we'll go ahead
and say 7, which is everything 7 debugging level and below.
Now that that's set, we'll go back
to R2, who has telnetted in on the R2 tab.
We'll do a debug IP packet again. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
We'll do a debug IP packet again.
And I don't see any packets.
If we go back to R1, they're happening at the console.
But from the terminal session, we do a show logging.
This says that we're monitor logging, level debugging.
Why are we not seeing these messages?
And the answer is, as far as troubleshooting, this.
We have to be willing at the terminal we're sitting at
to say, I want to see this.
And now we do terminal monitor.
Well now go ahead and see that information.
So we've taken a look at how to configure the logging WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
So we've taken a look at how to configure the logging
level for a destination.
We also take a look firsthand at telnetting in, and also
troubleshooting some VTY access.
But telnetting in and doing the terminal monitor.
And if we're going to turn it off, it's terminal--
oh my gosh-- terminal no monitor.
Probably one of the toughest commands to do.
So terminal no monitor right there.
It turns off that feature.
But the debug is still running.
So we've got to turn it off as well.
So un debut all will certainly do that.
And I will type in exit.
And we'll exit out of the VTY connection.
One last thing I'd love to do is do a show logging. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
One last thing I'd love to do is do a show logging.
In this lab, let's add a syslog server.
And the way we're going to do that
is go to configuration mode.
We know what the IP address is of our syslog server.
And we do logging, host.
And let's say it's 1.2.3.4.
That's our host.
Great.
Boom.
And then we can also specify the level of messages
to send to that destination.
So logging trap, and then the level we want to send.
So there's your levels again. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
So there's your levels again.
So if we want to send level 7 and below to that syslog
destination, we can.
That's what I'm going to do right here.
Now, if we just showed logging, and go down just a little bit,
now it's showing us that we're doing logging to a destination
server at 1.2.3.4.
There's the default port we're using.
If it's not working, make sure that port's
available over the network to that destination.
And we are logging at level debugging based
on what we said right there.
And one last thing while we're here,
if you want to disable logging to a destination,
we can do that, too. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
we can do that, too.
If we've got to turn off logging to the monitor altogether
for VTY lines, just do no logging monitor.
And that is one way to turn that off.
Show logging.
It is disabled right there.
On some IOSs, if you try to turn off logging everywhere,
the console will still do some logging.
It's like, I've got to say it somewhere.
I've got to tell somebody.
Some versions of IOS, some devices,
just will not let you turn everything off.
Others will.
So this is how you could turn it off on a particular destination WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
So this is how you could turn it off on a particular destination
just by saying no.
So in this video and lab, we've had the opportunity
to tweak the log message in the format of what we're
going to see in those messages, to configure
additional destinations, like another syslog server,
and we've also had the opportunity to tweak the levels
that we're going to use to assign
for our various destinations.
In the example we used, we tweaked what
was being sent to the monitor.
And we also verified that if you don't do terminal monitor
on your VTY end, you're not going
to see the log messages regardless
of what's being permitted. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
of what's being permitted.
So I'll see you in the next video, where
we'll take a look at some conditional debugging, which is
some pretty cool stuff as well.
Until then, I hope this has been informative for you.
And I'd like to thank you for viewing.