top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

concurrent telnet output processing

+1 vote
322 views

Is it possible to pipe a telnet client so that, concurrently, remote output is concurrently logged to a file and displayed on the terminal?

Right now, I'm using Apache TelnetClient for this, but I think it might actually be more awkward then using libtelnet or something along those lines, just not sure how to get started with that.

posted Sep 5, 2013 by Dewang Chaudhary

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
Try "script". It saves a terminal session to a file.
it doesn't write to the file concurrently. Most output doesn't show up  until you end the script. That's the trick, to do it concurrently. The only way I could think of would be to use threads...

1 Answer

+1 vote
 
Best answer

use something like this:

telnet {whatever args you need} | tee filename.log

or if you need standard output and standard error output you could try this:

telnet {whatever args you need} 2>&1 | tee filename.log
answer Sep 5, 2013 by Naveena Garg
Similar Questions
+1 vote

I have got a bash script that has two parts.
1. runs a script as a different user (using su -c )
2. when that part finishes, the script does a copy of the files created to another directory
I want to log the output of the entire script into one file. i.e.: internal script>external script> logfile
Whats the best way to do this?

+1 vote

For my project I need to know that - is there a way to log or capture the cause of android reboot, whether user manually powered off / rebooted the devices or wether system_server got restarted by adb kill or it was watchdog who restarted the device.

+2 votes

My Apache server host few applications something like :

/var/www/A
/var/www/B

I would like to trace access for a specific application, eg. A. Is it possible?

Or should I use 'LogLevel info' and so log all applications into access.log file (then parsing for specific web page) ?

My config for logging is :

..
ErrorLog /var/log/apache2/error.log
LogLevel info
CustomLog /var/log/apache2/access.log combined
..
+2 votes

Is there a way to force Tomcat to set permissions on log files when they’re created? It seems as though this would be something defined in the logging.properties file, but it doesn’t seem like it’s an option.

I want the permissions of all log files created (on server startup/log rollover) to be 640. The only way I can think of doing this is either adding the command to the startup script, or by running a cron job every hour or so. However, if there is a way to make sure the log files are never more permissive than 640, that would be greatly preferable.

+4 votes

I have an application which sets up logging after parsing the args in the main() funktion. It needs to be setup after parsing the args because I can set the loglevel via commandline flags.

I have tried many variants on how to do that but every time with an weird result. What I want is logging in from all libs and really understand that doing this should be enough there:

from logging import getLogger

logger = getLogger(__name__)

But, I need to setup the logger in the main() function to log only to a file and not to console because my application has an own shell interface which should not be spammed with log messages - never a message should show up there.

I think it should be only some few lines of code but I can't figure that out. The logger should be configured to have a max file size and rotate logfiles. Can someone help me with this?

...