Installing Syslog-ng on Ubuntu 22.04 LTS

Introduction

syslog-ng is an open-source implementation of the syslog protocol, which is a standard for message logging in Unix and Unix-like systems. The syslog protocol is widely used for collecting, processing, and transmitting log messages from various devices and applications within a network. It helps centralize log management and enables administrators to monitor and analyze system events efficiently.

Prerequisites

  • Up and running ubuntu 22.04 LTS machine.
  • Basic knowledge in linux commands.
  • Internet connectivity.

In this post, We will show you how to install syslog-ng on ubuntu 22.04 LTS linux machine.

Step 1: Run System Update

We need to execute the following command in order to update the current ubuntu repository.

sudo apt-get update

Step 2: Upgrade Default Packages

We need to use the following command to upgrade the default ubuntu packages.

sudo apt-get upgrade -y

Step 3: Installing Syslog-ng

We are good to install syslog-ng on ubuntu machine just execute the following command.

sudo apt-get install syslog-ng -y

Step 4: Start Syslog-ng Service

Once the installation is complete, you can start the syslog-ng service:

sudo systemctl start syslog-ng

To enable syslog-ng to start on boot, run:

sudo systemctl enable syslog-ng

Now, syslog-ng should be installed and running on your Ubuntu 22.04 system. You can check its status to ensure that it’s running without any issues:

sudo systemctl status syslog-ng

Step 5: Verify Syslog-ng Version

To verify installed Syslog-ng version, We need to execute the following command.

syslog-ng --version

Step 6: Updating Syslong-ng Version

We need to update the syslog-ng version by using given command.

sudo sed -i 's/@version: 3.27/@version: 3.35/g' /etc/syslog-ng/syslog-ng.conf

After this we need to reload the syslog-ng service to get new changes.

Step 7: Reloading Syslog-ng Service

Use the given command to reload the syslog-ng service.

sudo systemctl reload syslog-ng

Step 8: TLS Certificate & Network Binding

sudo nano /etc/syslog-ng/conf.d/network.conf
# Enable TLS
source s_net {
    tcp(ip("0.0.0.0") port(514)
        #tls( key-file("/home/aftab70/private-key.pem")
        #     cert-file("/home/aftab70/public-cert.pem")
        #     peer-verify(optional-untrusted))
    );
};


# Log destinations
destination d_logs {
    file("/var/log/logs.txt");
};

# Log paths
log {
    source(s_net);
    destination(d_logs);
};

Step 9: Reload Syslog-ng Service

sudo systemctl reload syslog-ng.service

Step 10: Verifying 514 Port

netstat -plntu | grep 514

We should get output like this.

Conclusion

We have successfully installed the Syslog-ng on ubuntu 22.04 LTS machine, If you still have questions, please post them in the comments section below.

Author

Installing Syslog-ng on Ubuntu 22.04 LTS

2 thoughts on “Installing Syslog-ng on Ubuntu 22.04 LTS

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top