Professional Web Applications Themes

syslog default port - Linux Setup, Configuration & Administration

I have searched high and low for a way to change the default port for syslog and found no doentation or previous newsgroup posts. Typically syslog runs on 514/udp. However, I would like my Linux server (RedHat 8.0) to send syslog messages out on a high port (like 1700) to a remote logging host. Is there any way to do this, short of changing the corresponding line in /etc/services? Editing this file just doesn't seem like a good idea. Thanks in advance for the assistance! Josiah Dykstra...

  1. #1

    Default syslog default port

    I have searched high and low for a way to change the default port for
    syslog and found no doentation or previous newsgroup posts.
    Typically syslog runs on 514/udp. However, I would like my Linux
    server (RedHat 8.0) to send syslog messages out on a high port (like
    1700) to a remote logging host. Is there any way to do this, short of
    changing the corresponding line in /etc/services? Editing this file
    just doesn't seem like a good idea.

    Thanks in advance for the assistance!

    Josiah Dykstra
    Josiah Guest

  2. #2

    Default Re: syslog default port

    On 11 Jul 2003 07:39:05 -0700, Josiah <josiahdykstrahotmail.com> wrote:
    > I have searched high and low for a way to change the default port for
    > syslog and found no doentation or previous newsgroup posts.
    > Typically syslog runs on 514/udp. However, I would like my Linux
    > server (RedHat 8.0) to send syslog messages out on a high port (like
    > 1700) to a remote logging host. Is there any way to do this, short of
    > changing the corresponding line in /etc/services? Editing this file
    > just doesn't seem like a good idea.
    I don't know if the sending port matters as long as it knows the remote
    port, and that syslogd is set to listen on that port. I think -a switch
    can set additional listening ports (not sure if just port number or other
    syntax).

    I did a little test with a Perl script to relay data written to a named
    pipe (fifo, like a file) to a remote syslogd and it works. So you could
    locally log to the fifo (set in syslog.conf) and it could relay to any
    host/port set in the script.

    For example from wireless1 I did:
    > echo This is a remote test > logfifo
    And it showed up in mainpc log as:
    Jul 12 01:50:31 wireless1 logrelay: This is a remote test

    The following script is not necessarily complete. For example $FIFO
    should likely be a full path and possibly modified ownership and/or
    permissions. You also may want to have it automatically daemonize itself
    into the background (per perldoc perlipc). But it proves the concept.


    #!/usr/bin/perl -w
    # logrelay - relays fifo (named pipe) to remote syslogd
    my $FIFO = 'logfifo';
    my $loghost = 'mainpc';
    my $logport = 514;

    $0 =~ m|([^:/\\]+)$|; # scriptname (without path) for logging
    my $script = $1;
    use IO::Socket;
    while (1) {
    unless (-p $FIFO) {
    unlink $FIFO;
    system('mknod', $FIFO, 'p')
    && die "can't mknod $FIFO: $!";
    }
    open (FIFO, "$FIFO") or die "Can't open $FIFO: $!";
    while ( <FIFO> ) {
    $remote = IO::Socket::INET->new( Proto => "udp",
    PeerAddr => $loghost,
    PeerPort => $logport,
    );
    unless ($remote) { die "can't connect to $loghost:$logport" }
    $remote->autoflush(1);
    print $remote "$script: $_";
    close $remote;
    }
    }


    --
    David Efflandt - All spam ignored [url]http://www.de-srv.com/[/url]
    [url]http://www.autox.chicago.il.us/[/url] [url]http://www.berniesfloral.net/[/url]
    [url]http://cgi-help.virtualave.net/[/url] [url]http://hammer.prohosting.com/~cgi-wiz/[/url]
    David Efflandt Guest

Similar Threads

  1. Sys::Syslog
    By Fletcher Mattox in forum PERL Modules
    Replies: 0
    Last Post: March 13th, 09:12 PM
  2. Sys:Syslog
    By Beau E. Cox in forum PERL Beginners
    Replies: 5
    Last Post: November 25th, 05:43 PM
  3. Replies: 2
    Last Post: September 15th, 08:36 AM
  4. syslog truncate
    By Sinisa in forum SCO
    Replies: 3
    Last Post: August 1st, 01:24 PM
  5. Replies: 3
    Last Post: July 23rd, 03:47 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139