Log Redirection to Remote Host | Unix Linux Forums | Red Hat

  Go Back    


Red Hat Red Hat is the world's leading open source technology solutions provider with offerings including Red Hat Enterprise Linux (RHEL), Fedora, open source applications, security and systems management, virtualization, and Services Oriented Architecture (SOA) solutions.

Log Redirection to Remote Host

Red Hat


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-10-2012
moshesa moshesa is offline
Registered User
 
Join Date: Jul 2012
Last Activity: 1 April 2014, 7:46 AM EDT
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Log Redirection to Remote Host

hey,

I need your help.

I have a rhel server that runs application, that application writing to her local application log.

I want that log will be realtime copying to a another remote rhel server.

The thing is that I prohibited touch the application code.


Is that possible?


Thanks
Sponsored Links
    #2  
Old 12-10-2012
Yoda's Avatar
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 17 October 2014, 11:59 AM EDT
Location: Galactic Empire
Posts: 3,387
Thanks: 235
Thanked 1,209 Times in 1,135 Posts
How about:

Code:
tail -f log_file | ssh user@host "sh -c 'cat > remote_log_file'"

Sponsored Links
    #3  
Old 12-10-2012
moshesa moshesa is offline
Registered User
 
Join Date: Jul 2012
Last Activity: 1 April 2014, 7:46 AM EDT
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
AMAZING.
thank you!

how do i permanence this? everyboot

and how do i logrotate this?
    #4  
Old 12-10-2012
Yoda's Avatar
Yoda Yoda is offline Forum Advisor  
Jedi Master
 
Join Date: Jan 2012
Last Activity: 17 October 2014, 11:59 AM EDT
Location: Galactic Empire
Posts: 3,387
Thanks: 235
Thanked 1,209 Times in 1,135 Posts
For starting it during every boot, you can write a script and put it in /etc/init.d/ . Google for instructions to start a command during boot up.
I think Log-rotation is going to be difficult for above command. May be you can force kill it and start with another file name when log size reaches a defined threshold.
Sponsored Links
    #5  
Old 12-10-2012
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
 
Join Date: May 2005
Last Activity: 19 October 2014, 3:14 PM EDT
Location: In the leftmost byte of /dev/kmem
Posts: 4,282
Thanks: 45
Thanked 824 Times in 651 Posts
It is probably easier to create a syslog-facility for this. Then you can use syslog to put this log output to another host. See the man page of syslog for details about how to achieve this.

I hope this helps.

bakunin
Sponsored Links
    #6  
Old 12-11-2012
moshesa moshesa is offline
Registered User
 
Join Date: Jul 2012
Last Activity: 1 April 2014, 7:46 AM EDT
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
thats what i tought!
doing it with syslog or rsyslog, but i know that the configuration is only by: facility and priority.
I search and the facilities are only by: mail.* , cron.* , kern.* ...

If you know how to manage an external application log with a syslog or rsyslog, its better and i would like to know how.

Thanks alot.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
what command for copy a filesystem (local host or remote host) bora99 Linux 1 02-29-2012 07:05 AM
Help! How to find the local host after few ssh hops to remote host??? gomes1333 UNIX for Advanced & Expert Users 3 03-27-2010 10:49 PM
running commands to remote host from centralized host anjum.suri Shell Programming and Scripting 6 08-18-2009 10:55 AM
Run a shell script from one host which connext to remote host and run the commands SN2009 Shell Programming and Scripting 6 04-13-2009 04:39 AM
How to delete the files from local host to remote host krishna176 Solaris 3 03-24-2007 04:48 PM



All times are GMT -4. The time now is 12:26 AM.