#1
|
|||
|
|||
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 (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!) |
Tags |
log file , logging , script |
Thread Tools | |
Display Modes | Rate This Thread |
|
|