Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-11-2017, 05:25 AM
Zander Zander is offline
Registered User
 
Join Date: Oct 2016
Posts: 11
Logging variables

Hi all,

I've currently got a script setup (with a lot of help from other forum members!) that I use multiple times every day. The function of the script is simple, I copy an IP address from a spreadsheet / wherever and then run the script on a server - The script will then login to a Cisco router and run some commands for me!

In the last week or so I've written in the functionality so that I can rename the CRT tab to the hostname of the Cisco router and I've also written in the ability for the script to change the log name to the router that I'm on!

I am however having some issues! I've got the logging sorted but I'm lacking some functionality. When setting up a pre-defined session in SecureCRT you can choose logging options such as "Upon connect:", "Upon disconnect:" & "On each line:"

What I would like to know, is there the ability to set these variables in a script so that once I start the new log I can see the connection times etc.?

For context here is the excerpt from my script...

Code:
'Setup logging using the CPE hostname
        If crt.Session.Logging Then
            ' Turn off logging before setting up individual CPE
            ' logging...
            crt.Session.Log False
        End If
        'Set the file path + Year & Month & then add the date 
		'to the beginning + the CPE hostname
		strCPELogName = ("C:\CRT\Logging\%Y\%M\%D_" & strHostname & ".txt")
        crt.Session.LogFileName = strCPELogName
		'Turn Logging on - True,True = On & append to make sure you don't
		'overwrite an old log if you log onto the CPE twice in one day
        crt.session.Log True,True
Thank you very much in advance!
(P.S. I'm unsure why my code on the forum doesn't have the correct / normal colouring so apologies if it's hard to read!)
Reply With Quote
 

Tags
log file , logging , script

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 07:58 AM.