Configure NXlog send logs to Graylog2


AllCloud Blog:
Cloud Insights and Innovation

Tested On

OS: CentOS 6.3 x86_64
Graylog2-Server Version: 0.11.0
Graylog2-web-interface Version: 0.11.0
NXlog Version: nxlog-ce-2.2
Hardware: Virtual Box 4.2.8

About

NXlog is a great tool to use to send your log files to graylog2 server.

In this guide a will show how to install nxlog with a simple configuration that set nxlog to listen for messages from a local file and send them to graylog2 server

Install NXlog

  • Download and install nxlog
  • Download and extract graylog2-radio
cd /usr/local/src
wget https://sourceforge.net/projects/nxlog-ce/files/nxlog-ce-2.3.1027-1.x86_64.rpm
yum localinstall nxlog-ce-*.rpm -y
  • Configure NXlog to send logs to graylog2 server
vi /etc/nxlog.conf
########################################
# Global directives                    #
########################################
User nxlog
Group nxlog

LogFile /var/log/nxlog/nxlog.log
LogLevel INFO

########################################
# Modules                              #
########################################
<Extension gelf>
    Module      xm_gelf
</Extension>

<Input in>
        Module  im_file
        File    "/var/log/messages"
</Input>

<Output out>
    Module      om_udp
    Host        graylog2-server.local
    Port        12201
    OutputType  GELF
</Output>

########################################
# Routes                               #
########################################
<Route r>
    Path        in => out
</Route>
  • Configure NXlog to start at boot and start it
chkconfig nxlog on
service nxlog start

That’s all. Now you can check your new log messages in graylog2 server

More guides inĀ Graylog2 Category

Useful links:

Lahav Savir

Founder and CTO, Cloud Platforms

Read more posts by Lahav Savir