Find the answer to your Linux question:
Results 1 to 5 of 5
Hello, I am trying to write a command, but I'm unsure if its even possible. Here is the general idea: Right now we have a small script that filters through ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2012
    Posts
    5

    Question command to print info from a remote machine


    Hello, I am trying to write a command, but I'm unsure if its even possible. Here is the general idea:

    Right now we have a small script that filters through our main syslog on our main syslog machine. basically the command is

    Code:
    cat /var/log/syslog | grep -i "parameter"
    I want to know if it is possible to do this same command from this machine to print the syslog of another machine. something like:

    Code:
    cat user<at>192.168.1.250:/var/log/syslog | grep -i "parameter"
    the <at> is because i can't post the at symbol apparently.

    I know this is obviously not correct, but is there a way to do it?

  2. #2
    Linux Engineer
    Join Date
    Apr 2012
    Location
    Virginia, USA
    Posts
    881
    ssh user@host grep -i "parameter" /var/log/syslog

    If you want to run more than one command:
    ssh user@host 'grep -i "parameter" /var/log/syslog; touch mynewfile; echo >> "hello" mynewfile; cat mynewfile'

    It's that simple!
    If you're doing this in a script, you can set up ssh keys so you don't have to type in the password.

  3. #3
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    sounds like you should set up rsyslog!

  4. #4
    Just Joined!
    Join Date
    Jul 2012
    Posts
    5
    Thanks for the tip mizzle! A friend actually told me this same thing yesterday so will go on with it.

  5. #5
    Just Joined!
    Join Date
    Jul 2012
    Posts
    5
    rsyslog is set up. For some reason unknown to us, 1 device (of which have 4 and 3 have no issue) will not log to our main Syslog server. However, it will log to another server running the same OS (Debian squeeze) without issue. the idea is our script is sort of interactive in that it allows you to choose what "type" of log you want to view--broken down into things like windows auth. failures, sharepoint failures, incorrect login attempts within linux systems, etc. This is all in one central location so if we are having issues, we run the same program, put in a few inputs, say 1 for windows production servers, then a for authentication failures, then 01 for syslog, 02 for syslog.1, 03 for syslog.2 (being previous logs).

    just an easier way to break down our logs.

Posting Permissions

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