Now, my requirement is, when I launch an ssh session, I want it to
start with logging enabled, but I do not want to go and manually
create 100+ sessions (number expanding weekly, if not daily) and mark
each session with logging enabled. This is not something feasible for
me. I read thru the PuTTY manual but did not see any command line
switch to accomplish this. I need to save my last, say 50, sessions
screen input and output to any server I go into, on my local machine.
I was hoping to write a batch file which will accept the server name
as a command line argument and create a new log file with datestamp
being part of the filename as well as the server name.
I thought of using AutoHotKey to send a series of keystrokes to the
terminal window to open up the context menu (drop down from upper left
corner) but could not figure out if there is a way to drop it down
with a key stroke. I tried, many combinations of win-alt-ctrl-shift
with any alphabetical and numerical keys but was not able to drop down
the context menu.
If anyone was able to accomplish this before, I really would like to
hear how you did it.
Thanks in advance.
You don't use command line switches. You set up a named session,
for example, toUnixServer, then set all the options you want for
that session including logging (see Session, Logging), then load
it at PuTTY startup:
putty -load "toUnixServer"
The log file can be customized to include hostname, date and time.
See the documentation (especially section 4.2):
http://www.chiark.greenend.org.uk/~sgtatham/putty/docs.html
--
Dale Dellutri <ddelQ...@panQQQix.com> (lose the Q's)
> You don't use command line switches. You set up a named session,
> for example, toUnixServer, then set all the options you want for
> that session including logging (see Session, Logging), then load
> it at PuTTY startup:
> putty -load "toUnixServer"
>
> The log file can be customized to include hostname, date and time.
This is the very thing that I am trying to avoid. Today I have 100+
servers tomorrow it will be 120 next year it will be god knows how
many. Trying to keep track of them by this manually creating session
files, is not something I want to do continuously. This is the thing
that I am trying to circumvent if you read my original message.
Otherwise I know the existence of this option. It just is not feasible
for me to employ.
I don't follow. Don't you want a command line option?
How is 'putty -load "toUnixServer"' significantly different for you from
a hypothetical (but unavailable) option like --logging?
--
Darren
> > You don't use command line switches. ?You set up a named session,
> > for example, toUnixServer, then set all the options you want for
> > that session including logging (see Session, Logging), then load
> > it at PuTTY startup:
> > ? putty -load "toUnixServer"
> >
> > The log file can be customized to include hostname, date and time.
> This is the very thing that I am trying to avoid. Today I have 100+
> servers tomorrow it will be 120 next year it will be god knows how
> many. Trying to keep track of them by this manually creating session
> files, is not something I want to do continuously. This is the thing
> that I am trying to circumvent if you read my original message.
> Otherwise I know the existence of this option. It just is not feasible
> for me to employ.
Then do it this way:
1. Modify the Default session to include logging with a
file name like unixserver-&H-&Y&M&D&T.log in whatever
directory you choose. The H will be filled in with
the hostname, YMDT with the year, month date time.
Save the Default session
2. In your batch file, start putty like:
putty.exe -ssh %user%@%host%
(I think that's the right DOS syntax)
where %user% and %host% will be filled in as you
described.
This will use the Default session which you already
modified to include logging.
All of this is described in the documentation at:
> Then do it this way:
>
> 1. Modify the Default session to include logging with a
> file name like unixserver-&H-&Y&M&D&T.log in whatever
> directory you choose. The H will be filled in with
> the hostname, YMDT with the year, month date time.
> Save the Default session
>
> 2. In your batch file, start putty like:
> putty.exe -ssh %user%@%host%
> (I think that's the right DOS syntax)
> where %user% and %host% will be filled in as you
> described.
>
> This will use the Default session which you already
> modified to include logging.
>
> All of this is described in the documentation at:
> http://www.chiark.greenend.org.uk/~sgtatham/putty/docs.html
>
> --
> Dale Dellutri <ddelQQQl...@panQQQix.com> (lose the Q's)
I tried doing this. I inserted a fixed log name, nothing fancy with %
signs and such, enabled logging everything (not just printable
characters) just to test and saved the default but when I start a
session, it still starts without the logging enabled.
How it is different is, when you use -load <profile> option, you are
assuming that the profile already exists and saved. I am trying to
avoid creating 100+ profiles, one-by-one as well as having to remember
to create a new profile everytime a new server gets added to the
landscape.
> > Then do it this way:
> >
> > 1. Modify the Default session to include logging with a
> > ?file name like unixserver-&H-&Y&M&D&T.log in whatever
> > ?directory you choose. ?The H will be filled in with
> > ?the hostname, YMDT with the year, month date time.
> > ?Save the Default session
> >
> > 2. In your batch file, start putty like:
> > ? ?putty.exe -ssh %user%@%host%
> > ?(I think that's the right DOS syntax)
> > ?where %user% and %host% will be filled in as you
> > ?described.
> >
> > This will use the Default session which you already
> > modified to include logging.
> >
> > All of this is described in the documentation at:
> > ?http://www.chiark.greenend.org.uk/~sgtatham/putty/docs.html
> I tried doing this. I inserted a fixed log name, nothing fancy with %
> signs and such, enabled logging everything (not just printable
> characters) just to test and saved the default but when I start a
> session, it still starts without the logging enabled.
I just tried this and it worked.
When you set up the "fixed log name", did you first browse to
a folder in which you have write permission? (The default
is probably not writable by you.)
Are you sure you saved the Default? If you bring up PuTTY via
the GUI, are your settings showing in the Session Logging config
panel?
Also, the "fancy" log names use "&" before variable names,
not "%".
Why would you need 100+ profiles for this? Just use whatever you use
today, enable logging, save a profile for it, then use that profile as
the argument to -load. That's only one profile....
--
Darren
Ahh, I see. It's not so much *enabling* the logging as getting the
filename set usefully based on the host you're connecting to. That was
the bit I misunderstood.
--
Darren