Have you ever wanted to go back in time and review output or input from a terminal session? Have you ever wanted to present undeniable proof about your CLI syntax, with time stamps, to your team or a customer?
If your answers to the above questions is yes, then you should be logging your terminal sessions.
Logging your sessions is a simple, yet a very important CYA policy that you should be practicing.
The two terminal emulators that I am most familiar with are Putty and SecureCRT. Both of these platforms allow you to log your sessions and though the logging expressions may be similar, I will be using SecureCRT for my examples in this post.
The first thing that I recommend you do is create a local document folder on your PC to store the logged sessions. If you like to keep things organized, having a dedicated log folder is choice.
Open the terminal emulator and navigate to: OPTIONS > GLOBAL OPTIONS.
Selecting Global Options presents you with a screen that has Default Session in the left sidebar – Choose Default Session. A screen appears with an Edit Default Settings box that you will select next.
The Edit Default Settings menu appears and you will need to navigate the left sidebar to the Log File option. Selecting Log File allows you to customize the terminal logging options.
Enter your log file name, which should include the location that you want to save the files (refer to the folder that you created for terminal logging) i.e. C:\Users\me\Documents\CRT LOGGING\custom_substitutions.log(or .txt.).
Now let’s look at the substitutions that you are able to add to the log file name to give you greater detail. I prefer to log the hostname and the session name. I put the hostname in parenthesis after the session name. I also like to log the exact time of the session. Here is an example of what my log file name looks like with my substitutions: C:\Users\me\Documents\CRT LOGGING\%S (%H) %h.%m.%s.log(or .txt). You have the option to separate substitutions in the log file name with spaces, underscores and periods – The file name also supports parenthesis.
Adding substitutions and setting up your log file to your liking is the fun part – You have quite a few options available to use.
Review the other options available to completely customize the way your terminal sessions log. As you can see in the screenshot above, I prefer to start logging upon connect.
The last thing to do is save your default session settings…
Now go setup terminal logging before you find yourself scrambling to prove your innocence after a production network resume generating event (RGE).