VanDyke Software Forums

VanDyke Software Forums (
-   Scripting (
-   -   ad-hoc session 'Custom log data'? (

Rhudi 09-17-2020 09:57 AM

ad-hoc session 'Custom log data'?
Is it possible to set "Custom log data" ('On each line') using VB?

I know how to create a log file (and even append if needed).

Currently, I do things like this (variables are set appropriately):

crt.Session.LogFileName =  UserProf & "\SecureCRT Logs\" & UserName & "\%Y-%M-%D.%h.%m - " & strShortHostName & " -- (" & UserName & ").log"
crt.Session.Log True

In other code that works, I can create/write a file that has my "Connect Banner" (Which is a bit more detailed than what is provided in logfile options).
Then, close that file and use it as a LogFileName with 'append'.
When I'm done, I close the LogFile, then open 'ForAppending' to write my custom disconnect footer.

The only option I'd really like is to be able to set through VB is "On each line".

bgagnon 09-17-2020 11:14 AM

Hi Rhudi,

What version of SecureCRT are you using?

Rhudi 09-17-2020 11:45 AM

Version 8.3.4 (x64 build 1699) - Official Release - July 12, 2018

I am not able to upgrade.

bgagnon 09-17-2020 12:23 PM

Hi Rhudi,

Please see SecureCRT's documentation regarding SessionConfiguration object in the Scripting / Script Objects Reference topic in the Help file.

The specific line in your session (or Default session if making an ad hoc connection) INI file is:
S:"Custom Log Message Each Line"=

So, you would use something like below to add a timestamp:

Set objTab = crt.GetScriptTab
Set objConfig = objTab.Session.Config
objConfig.SetOption "Custom Log Message Each Line", "%h:%m:%s -- "

All times are GMT -6. The time now is 06:22 AM.