SecureCRT can be configured to begin logging to a file starting from the moment a connection is fully established. You can also configure SecureCRT to automatically name the log file with date, time, and specific session information (like hostname or session name), or even place the log file into a folder structure that parallels what you see in SecureCRT's Session Manager.
The video SecureCRT Log File Name Substitution Parameters on the VanDyke Software YouTube channel shows how to set up automated logging and how to use SecureCRT's log file name substitution parameters.
A related video, Timestamping Logged Lines - SecureCRT Custom Log Data, shows how to configure SecureCRT logging to place custom-formatted timestamp information at the beginning of each line.
The tip below summarizes and expands upon the information contained in the two videos referenced above.
Set Up Automated Logging on a Per-Session Basis
Below are some common questions about configuring SecureCRT to log session data to a file.
With the "Start log upon connect" option enabled, when will SecureCRT start logging data to the specified log file?
Where will SecureCRT write data being logged?
The log file name and the path where the file is saved can be configured in the Log file name entry box. If you want a new log file to be generated each time you connect, SecureCRT's log file substitutions can be used in the Log file name entry box to ensure a unique log file name is generated upon each connection. Here's one example that would create a unique path and log file name for the session whenever a new connection is made:
C:\Users\user\Documents\SCRT_Logs\%F\%S(%H)-%Y%M%D-%h%m%s_%t_log.txt
The Log File category dialog contains a partial list of common log file name and customer log data substitutions. Below is complete list of log file substitutions available for use in SecureCRT's log file configuration (a complete list can also be found in the SecureCRT Help file’s Session Options / Terminal / Log File topic):
%H | - | hostname (not valid with protocols that do not specify a host, such as Serial) | |
%S | - | session name | |
%Y | - | four-digit year | |
%y | - | two-digit year | |
%M | - | two-digit month | |
%D | - | two-digit day of the month | |
%P | - | port (not valid with protocols that do not specify a port, such as RLogin) | |
%h | - | two-digit hour | |
%m | - | two-digit minute | |
%s | - | two-digit seconds | |
%t | - | three-digit milliseconds | |
%F | - | directory path starting below the "Sessions" folder | |
%% | - | percent (%) | |
%envvar% | - | environment variable |
In this example, here's what an automated logging setup might look like: The log file name, path, and substitution variables have been configured in the Log file name entry box, and the Start log upon connect and Timestamp each line options have been selected.
Note: If you don't see the Timestamp each line option in the Session Options / Log file dialog, it means your version of SecureCRT is an earlier version that does not support this feature.
You can also customize the format of the timestamps on each line as demonstrated in the Timestamping Logged Lines - SecureCRT Custom Log Data video referenced above.
For example, in the screenshot of the Session Options / Log File dialog below, the following log data substitutions are entered into the On each line entry box:
[%Y-%M-%D %h:%m:%s.%t]
What if I want to use this configuration for all my SecureCRT sessions?
To ensure that every one of your sessions is configured this way, instead of changing just one session, you can make the changes in SecureCRT's Default session. When you make a change to SecureCRT's Default session, you are offered the opportunity to apply the changes to ALL of your sessions at once.
Important: Prior to making any major changes in the Default session, make sure to back up your full configuration to an XML file via the Tools / Export Settings... menu option so you can revert to the saved configuration if something unexpected goes awry.
In SecureCRT 9.4 and later, the Default session is available via the Options / Configure / Default Session... menu item.
Once you've opened the Default Session, simply make the changes outlined above: configure a session- and time-based log file name, then enable Start log upon connect in the Terminal / Log File category of the Session Options - Default window. Once this new logging information has been configured in the Default session, simply press OK, and when SecureCRT asks if you want to apply the changes to all of your sessions, select the option Change ALL sessions (no undo).
The SecureCRT Log File Name Substitution Parameters video referenced above details this process from 3:04 onwards.
Note: In order for settings from the Default session to be applied to all sessions, the option you want to propogate must not already be the desired value in the Default session before you begin editing. If this is the case, SecureCRT won't be able to detect any changes to apply. Only settings which have different values than those that were in place before the Default session was opened for editing are applied to all sessions. If your first attempt at propogating Default session option values to all your sessions doesn't work as expected, try changing the targeted option values to something undesired and apply that change only to the Default session. Then you can edit the Default session and set the targeted options to the desired value and apply the changes to all of your existing sessions.
Are there any cross-platform considerations for SecureCRT on Windows/macOS/Linux?
The same general capabilities apply to SecureCRT on macOS and Linux platforms, but some of the underlying details may be different than face value. For instance, in the examples shown above, the path to the Log file name entry box is displayed in the Session Options window as:
C:\Users\user\Documents\SCRT_Logs\%F\%S(%H)-%Y%M%D-%h%m%s_%t_log.txt
However, in the underlying .ini file containing the configuration, this is written/stored as follows:
${VDS_USER_DATA_PATH}\SCRT_Logs\%F\%S(%H)-%Y%M%D-%h%m%s_%t_log.txt
By design, SecureCRT uses the substitution named ${VDS_USER_DATA_PATH} to represent the "Documents" folder. This approach facilitates the same configuration files being used on Windows, macOS, or Linux platforms. The "Documents" folder is a well-known location for which a substitution name is used in its place. Here is a list of substitution names for all of the well-known locations:
${VDS_CONFIG_PATH}
SecureCRT's config folder path (as defined in Global options, Configuration paths category). If SecureCRT's configuration path is set to C:\Users\user\AppData\VanDyke\Config, any file-related setting that contains this path will result in the path being substituted with ${VDS_CONFIG_PATH} when saved to the .ini file. For example, if the Log file name entry box in the Session Options dialog on macOS is set to a value of /Users/user/Library/Application Support/VanDyke/SecureCRT/Config/Logs/%S/%Y%M%D_%h%m%s_%t_Log.txt, this value is written to the underlying .ini file as ${VDS_CONFIG_PATH}/Logs/%S/%Y%M%D_%h%m%s_%t_Log.txt
This means that if this same session configuration is loaded on a Windows machine where the configuration folder is set to C:\Users\user\Application Data\Roaming\VanDyke\Config, when read in from the .ini file, the ${VDS_CONFIG_PATH} is automatically converted to reflect SecureCRT's current configuration path.
${VDS_INSTALL_PATH}
The location where the SecureCRT application binary itself lives. This might not be as useful for many individuals, since normal user accounts don't have write access to this location.
${VDS_USER_DATA_PATH}
The location to the user's "My Documents" or "Documents" folder. In this and other cases, you can combine a substitution with relativism, if needed (e.g., ${VDS_USER_DATA_PATH}\..\..\folderB\etc\).
${VDS_SSH_DATA_PATH}
The location of user-specific SSH data.
On Windows, ${VDS_SSH_DATA_PATH} resolves to the user's Documents folder — it is no different than the value of ${VDS_USER_DATA_PATH}.
On macOS/Linux, ${VDS_SSH_DATA_PATH} resolves to the user's ~/.ssh directory.
VanDyke Software uses cookies to give you the best online experience. Before continuing to use this site, please confirm that you agree to our use of cookies. Please see our Cookie Usage for details.
Here you can control cookies using the checkboxes below. Some cookies are essential for the use of our website and cannot be disabled. Others provide a convenience to the user and, if disabled, may reduce the ease of use of our site. Finally, some cookies provide anonymous analytic tracking data that help us provide the user with a richer browsing experience. You can elect to disable these cookies as well.