banner



How To Install Syslog Ng On Ubuntu

This post shows a guideline for a basic installation of the open source syslog-ng daemon in order to store syslog messages from various devices in a separate file for each device.

I am using such an installation for my firewalls, routers, etc., to take an annal with all of its messages. After on, I can grep through these logfiles and search for specific events. Of course it does not provide whatsoever built-in filter or correlation features – it is obviously not a SIEM. However, as a outset footstep it'southward better than nothing. ;)

Prerequisites

This tutorial relies on a blank Linux (server) installation such as shown here. I am using an Ubuntu server. I furthermore presume that the reader is enlightened of its devices that are capable of sending syslog letters. That is: I am merely showing the syslog-ng installation and no further details on how to ship syslog messages from various devices to the server.

Installation

The first step is to install the syslog-ng package. I am using an Ubuntu server:

[UPDATE] On a fresh 64-flake Ubuntu 14.04.2 LTS, I got an error while trying to install syslog-ng. The following answer found in the Internet works:

[/UPDATE]

The default configuration file is /etc/syslog-ng/syslog-ng.conf . On Ubuntu, it has already a few lines that generate logfiles at /var/log/ , e.g., the basic logfile "syslog", which can be tailed with tail -f /var/log/syslog to see incoming letters from the system itself.

Configuration

I will now show the bones configuration of syslog-ng in society to:

  1. take an ain folder for each device with
  2. a new file every mean solar day, nested in folders for year and month.

This requires a "source", "filter" and "destination" which are so jump together. For more detailed configuration commands, this wiki from archlinux gives many good examples.

ane) Source

Since the concluding line in the "syslog-ng.conf" config file ( / etc / syslog - ng / syslog - ng .conf ) is @ include "/etc/syslog-ng/conf.d/" , all configuration files in the folder "conf.d" will be processed, as well. Therefore, I generated a new configuration file called "firewalls.conf" in that subfolder sudo nano / etc / syslog - ng / conf .d / firewalls .conf . It has the post-obit lines in information technology:

(Note: Supercede USERNAME and USERGROUP with the name and group of the account from which the logfiles should be wrote to the deejay such as "root" and "root".)

This "source s_udp" object is quite generic and simply listens on udp port 514 on both Internet Protocols (IPv6 and legacy IP) for incoming syslog messages. Information technology must appear simply once in the config file.

2a) Generic Destination

The simpliest way to generate a dissimilar folder for every device is to use the following destination (without a specific filter). This adds a folder with the "$HOST" attribute, which is most commonly the IP accost of the logging device. With this few lines, no more than filters/destinations are required to log from many devices. (Cheers to the comment from "T", who ticked me to search for this solution):

or 2b) Specific Filter & Destination

Another manner is to write a filter for incoming log messages in order to save them in a specific destination folder. Following is the template. The only lines to modify are the two UPPER Example variables without the $ sign (i.east., NAMEOFTHEFIREWALL and IPOFTHEFIREWALL):

That is:

  • the filter "f_NAMEOFTHEFIREWALL" filters upon the source IP accost from the sending device,
  • the destination "d_NAMEOFTHEFIREWALL" is set to the hierarchical path,
  • and finally the "log" sequence takes any letters from the source and uses the filter to shop into the destination path.

These few lines in the template tin appear many times in the config file. (Remember: the source s_udp must appear only once.) Then you tin can copy & paste information technology for every syslog device.

Final Restart

A restart of the syslog-ng daemon is required to take the only added configuration active:

After that, netstat -tulpen shows a few lines which reveal that the port 514 is listening on IPv6 and legacy IP:

That is, all devices are now logging into the syslog-ng server, in my example the /var/log/firewalls directory:

The paths are quite long just structured, eastward.thousand.:

Examples

This is how syslog messages from a Palo Alto firewall look similar when changing some policy rules:

This are some Juniper ScreenOS logs during agile Internet connections:

And this are some Cisco router log letters:

That's it. ;)

Featured image: "Erika 9 typewriter" by dr. shordzi is licensed under CC BY-SA 2.0.

Source: https://weberblog.net/basic-syslog-ng-installation/

Posted by: cannadygles1968.blogspot.com

0 Response to "How To Install Syslog Ng On Ubuntu"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel