VanDyke Software Forums

VanDyke Software Forums (
-   Scripting (
-   -   Multiple tabs/logs with time stamps (

AlexG 02-16-2020 06:58 AM

Multiple tabs/logs with time stamps
Need help please.
I am running Python script that opens a few tabs, each to the same IP but different port. Activate log per tab. In addition, want to have time stamp in front of every log’s line.
One option that I may use – is to configure default session with option “on each line” something like “%h-%m” and to use in the script option “crt.Session.LogUsingSessionOptions” which will set per tab default configuration including per line time stamp. However, since I have same IP and different ports per tab, I have no option to have unique log name. I may include Host name (IP) as part of name (%H) and session name %S (which in default session is the same for all tabs), but there is no option to include port as part of name. Therefore, I get a few log files with the same name (including time stamp into log name does not help to distinguish between them). Not sure whether I could change name on later stage, also would help.
Another option that I tried, is to configure each session individually, like:
objTab.Session.Log (False)
objTab.Session.Config.SetOption("Custom Log Message Each Line", "%D_%h_%m")
objTab.Session.LogFileName = strPath + strCaption + "(" + port + ")_%D-%M-%Y-%h_%m_%s.txt"
objTab.Session.Log (True)
I get unique names for log files but no time stamps.
Much appreciate help.

bgagnon 02-17-2020 01:45 PM

Hi AlexG,

I have replicated your results and have created a bug report.

I will post here if the developers have further questions or when there is further news.

For direct notification, please send an email to and reference Forum Thread #14080 in the subject line.

bgagnon 02-17-2020 01:52 PM

Hi AlexG,

As a note:

Changes in SecureCRT 8.3 (Beta 1) -- September 21, 2017
New features:
  • Added support for the %P logging substitution for Serial sessions.
Not sure why the history note specified Serial. I just tested with an SSH connection to an alternate port and it worked. :)

I see, we actually added it for other protocols much earlier.

Changes in SecureCRT 7.1 (Beta 1) -- February 26, 2013
New features:
  • Added a new logging substitution variable "%P", which inserts the session's port.

AlexG 02-18-2020 06:01 AM

Multiple tabs/logs with time stamps
Dear Brenda,
Thanks a lot. I was using 7.0.3 version.
After I upgraded to 7.3.3 I indeed found option for %P for logs distinguishing and was able to get time stamps in each line of multiple logs using crt.Session.LogUsingSessionOptions.
But I found that to have time stamps, I have to enable "Start log upon connect", otherwise no time stamps. Here I got next "trap".
In my case I will have multiple disconnections and connections. Therefore, new log will be opened upon each connection and having tenths or hundreds such for sure complicates analysis.
If I will use "Append to file" option to avoid multiple new logs, file name should not have time stamp to allow this.And then if I am running script next time, it will append data to previous log which is not convenient.
Any idea how to overcome this?
Thank you

bgagnon 02-18-2020 10:29 AM

Hi Alex,

As a note, any changes/fixes are going to be in v8.7 or later.

The only way I know to solve your dilemma presently is to not use timestamps as part of the filename. For sure, not the second specification and possibly minute and hour depending on how often you need to stop/start logging. :)

All times are GMT -6. The time now is 03:49 PM.