SCRT 的功能非常的強大,至今沒有發現替代者(什麼?Xshell?某些原因,打死我也不會用)。
簡單介紹一下SCRT 的記錄log功能,我們在運維、開發、測試等需要通過SSH、串口連接設備,我們希望能夠記錄我們輸入的命令、設備的輸出的信息等,大多數的軟件都可以實現這樣的功能,而SCRT 還可以記錄每一行信息的時間,這樣我們可以方便的追溯日誌發生的時間、不同日誌之間的時間間隔等,下面簡單介紹可以實現的功能:
- 不同 host 的 session 記錄到不同的文件;
- 同一個 host 的 session 不同時間建立的 connection 記錄到不同的文件;
- 記錄 session 建立的時間;
- 記錄斷開 session 的時間;
- 記錄每一行日誌的時間;
下面介紹一下如何實現:
在SCRT---> Options-->Global Options-->General -->Default Session-->Edit Default Settings -->Log File:
指定Log file Name:D:\Green\SecureCRT\log\%H_%Y%M%D_%h%m.log
Upon connect: ----start--- %Y%M%D
Upon disconnect: ----end--- %Y%M%D
On each line: %h:%m:%s:%t
結果:
關於變量的說明
Substitutions group
In the dialog, this section lists some of the variables that SecureCRT can expand when writing to the log file. A complete list is shown below.
%H - hostname
%S - session name
%Y - four-digit year
%y - two-digit year
%M - two-digit month
%D - two-digit day of the month
%P - port
%h - two-digit hour
%m - two-digit minute
%s - two-digit seconds
%t - three-digit milliseconds
%% - percent (%)
%envvar% - environment variable
效果圖: