Saving Your Putty Sessions To A Log File

Putty is a widely used, free, tool to SSH/Telnet/Console/etc into a network device. I can’t recall how many times I’ve burned myself because I fat-fingered the keyboard and then lost my connection to the network device or misconfigured an interface and not realize it for a couple of days. Or what if you wanted to remember what you did a couple of months ago on a switch?

Putty allows you to log each of your sessions. It has saved my bacon so many times.

Here’s how to configure it. First, highlight the Default Settings:

Then on the left pane, click on Logging under Session.

Under the Session Logging section, select “All session output”
For the log file name, use this structure: &H-&Y&M&D-&T.log

&H – This will append the hostname of the device to the front of the file. I add a dash after this to separate it from the dates.

&Y&M&D – This adds the year, month, and day. Add a dash afterwards to separate it from the time.

&T – This adds the time you logged into the device. Because you may log into the same device multiple times per day, this is a good way to log each session separately.

Click on browse to save it to a specific location. Your log file will then look like: 192.168.1.1-20131024-075505.log

Simple!

Now go back to the Session window, click on Default Settings, and click Save. So next time you open Putty or create a new saved session, it will create the log file.

Let’s see it in action. I’m going to create a new saved session for the ATT Looking Glass route server: