Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
How to capture logs in host machine from console machine (remote machine). remote machine can be connected through telnet. Some information or logs are present at remote machine. Now, how ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2012
    Posts
    14

    how to copy logs from remote machine


    How to capture logs in host machine from console machine (remote machine).
    remote machine can be connected through telnet.
    Some information or logs are present at remote machine.
    Now, how to get those logs which are present at remote machine on host machine by running a command.
    Like example:
    Console machine is connected through
    telnet 10.68.114.30 <portnumber>
    login: <login id>
    password: <pwd>
    Starts printing some logs.

    Host machine:
    #command (which has to print the logs in host machine)

    I hope there wouldn't be straight way. But, please guide me to proceed further.

    Thanks in advance.

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,307
    Quote Originally Posted by tutika View Post
    How to capture logs in host machine from console machine (remote machine).
    remote machine can be connected through telnet.
    Some information or logs are present at remote machine.
    Now, how to get those logs which are present at remote machine on host machine by running a command.
    Like example:
    Console machine is connected through
    telnet 10.68.114.30 <portnumber>
    login: <login id>
    password: <pwd>
    Starts printing some logs.

    Host machine:
    #command (which has to print the logs in host machine)

    I hope there wouldn't be straight way. But, please guide me to proceed further.

    Thanks in advance.
    It would be easier for you if you could use ssh (or even rsh, as security is clearly not a issue). is this a possibility?

    if it isn't, then you can look into using the expect program. it allows you to script a normally non-interactive login. Just google for it, here is one example:

    http://www.osix.net/modules/article/?id=30
    Last edited by atreyu; 08-25-2012 at 01:47 PM. Reason: non-interactive, duh

  3. #3
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,221
    Hmm, what is the exact usecase?
    Do you want to occasionally see the current, ongoing logs from this console machine on the host machine? Then follow atreyu´s advice.

    If you want to transfer and store these logs on a different machine, combined with grouping and search capabilities,
    then have a look at rsyslog and LogAnalyzer.
    You must always face the curtain with a bow.

  4. #4
    Just Joined! Fishbone_Beat's Avatar
    Join Date
    Nov 2009
    Location
    Costa Rica
    Posts
    19
    You can also use rsync to get the logs, or scp. I think rsync can work for you pretty well.

  5. #5
    Just Joined!
    Join Date
    Mar 2012
    Posts
    14
    Thanks atreyu
    But I have no chance to install a new tool..

  6. #6
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,307
    Quote Originally Posted by tutika View Post
    Thanks atreyu
    But I have no chance to install a new tool..
    are you referring to expect? fair enough.

    what about ssh, scp, rsh, rsync - are any of those available on the system? if you don't know what's running on the system, take a look in ps, e.g.:

    Code:
    ps auxww
    also check in the startup directory for initialization scripts, maybe there is something there that is not running that you could use:

    Code:
    ls -l /etc/rc.d/
    from another machine, you can see what network ports are already open, e.g.:

    Code:
    nmap -n <IP_ADDRESS>
    a final thought, there is often a trick suggested that is "pure bash": use a HERE document to send authentication and command on STDIN (standard input). it is quite hit or miss, in my experience. go ahead and try it.

    Code:
    #!/bin/sh
    username='user'
    password='secret'
    ip_address='1.2.3.4'
    telnet $ip_address <<EOF
    $username
    $password
    #your command here
    EOF
    make sure that EOF is on a line all by itself with a newline char at the end.

  7. #7
    Just Joined!
    Join Date
    Mar 2012
    Posts
    14
    I understand the rsyslog and loganalyzer are the tools used on windows machine. Actually I couldn't install any tools and have to copy the stuff with the existing commands. Thanks for your reply.
    Please correct me if my understanding is wrong about rsyslog and loganalyzer tools.

  8. #8
    Just Joined!
    Join Date
    Mar 2012
    Posts
    14
    I understand that rsync is also like scp which copies file from target machine. Currently, I am working on this stuff. Thanks!

  9. #9
    Just Joined! Fishbone_Beat's Avatar
    Join Date
    Nov 2009
    Location
    Costa Rica
    Posts
    19
    Quote Originally Posted by tutika View Post
    I understand that rsync is also like scp which copies file from target machine. Currently, I am working on this stuff. Thanks!
    For your use case, I think rsync might be a better solution as it is a little easier to understand than scp and with it you can have the exact same folder and files on your host and remote machine. For example, you create a folder called 'consolemachinelogs' on your home machine and use rsync to retrieve the logs, you can even setup a cron job so that every days rsync retrieves and sync the 2 folders so you don't
    to input the command every day.

  10. #10
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,221
    Quote Originally Posted by tutika View Post
    I understand the rsyslog and loganalyzer are the tools used on windows machine. Actually I couldn't install any tools and have to copy the stuff with the existing commands. Thanks for your reply.
    Please correct me if my understanding is wrong about rsyslog and loganalyzer tools.
    rsyslog and loganalyzer are both unix tools.
    You must always face the curtain with a bow.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •