0

I have already sent logs via NXlog to Graylog2 successfully. But both, NXlog and Graylog2 run on the same Server. Now i want to send logs from another Server via NXlog to Graylog2, but ist not working at all. Can you help me out pls? This is my NXlog configuration:

User i_cdp
Group int

Panic Soft

#define CERTDIR /opt/cdp/nxlog/opt/var/lib/nxlog/cert
define CONFDIR /opt/cdp/nxlog/opt/var/lib/nxlog
define LOGDIR /opt/cdp/nxlog/opt/var/log/nxlog
define LOGFILE "%LOGDIR%/nxlog.log"

SpoolDir /opt/cdp/nxlog/opt/var/spool/nxlog

# default values:
PidFile /opt/cdp/nxlog/opt/var/run/nxlog/nxlog.pid
CacheDir /opt/cdp/nxlog/opt/var/spool/nxlog
ModuleDir /opt/cdp/nxlog/opt/libexec/nxlog/modules

<Extension _syslog>
    Module      xm_syslog
</Extension>


<Extension gelf>
    Module      xm_gelf
</Extension>

<Input in>
    Module      im_file
    File       "/opt/cdp/jboss-eap/jboss/standalone/log/*.log*"
    Exec if $raw_event =~ /(\d\d\d\d\-\d\d-\d\d \d\d:\d\d:\d\d)/ $EventTime = parsedate($1);
    Exec $Hostname = 'bsul0850';
    Exec if $raw_event =~ /ERROR/ $SyslogSeverityValue = 3; \
    else $SyslogSeverityValue = 6;
    Exec $FileName = file_name();
    Exec if $raw_event =~ /WARN/ $Message = 'IMPORTANT!! ' + $raw_event;
    Exec $SourceName = 'jboss';
</Input>


<Output out>
    Module   om_udp
    Host    10.41.66.84
    Port    12009
    OutputType GELF
</Output>


<Route r1>
    Path        in => out
</Route>

<Extension _charconv>
    Module      xm_charconv
    AutodetectCharsets iso8859-2, utf-8, utf-16, utf-32
</Extension>

<Extension _exec>
    Module      xm_exec
</Extension>

<Extension _fileop>
    Module      xm_fileop
    # Check the size of our log file every hour and rotate if it is larger than 5Mb
    <Schedule>
        Every   1 hour
        Exec    if (file_exists(%LOGFILE%) and (file_size(%LOGFILE%) >= 5M)) file_cycle(%LOGFILE%, 8);
    </Schedule>

    # Rotate our log file every week on sunday at midnight
    <Schedule>
        When    @weekly
        Exec    if file_exists(%LOGFILE%) file_cycle(%LOGFILE%, 8);
    </Schedule>
</Extension>

I have opened Port 12009 for a connection between the server with Nxlog and the Server with Graylog2. Then I configured an Input on the Graylog-Gui: Input(GELF UDP on Port 12009) But wehen i check the connection, I only get:

[i_cdp@bsul0850 etc]$ ssh -vvv bsul0959 -p 12009
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to bsul0959 [10.41.66.84] port 12009.
debug1: connect to address 10.41.66.84 port 12009: Connection refused
ssh: connect to host bsul0959 port 12009: Connection refused

It says, refused. So there is kind of a connection because I don't get a timeout or something like that, am I right? The Graylog server just doesn't accept connection. So, what's wrong with my configuration? Graylog doesn't receive anything.

Thank you in advance :)

Emre Sahin
  • 21
  • 1

1 Answers1

0

Using ssh to check for an open port is a little weird. Note that ssh uses TCP and Graylog is listening on the UDP port so you need to diagnose this differently.

b0ti
  • 2,319
  • 1
  • 18
  • 18