How to Install Fluentd on Elementary OS Latest

Fluentd is an open-source data collector designed to unify logging infrastructure. It can collect logs from various sources, process them, and send them to different destinations like Elasticsearch, Amazon S3, or PostgreSQL. In this tutorial, we will guide you through the process of installing Fluentd on Elementary OS Latest.

Prerequisites

Before beginning with the installation of Fluentd, ensure the following prerequisites are met:

Step 1: Install Required Dependencies

The first step is to install the packages required for Fluentd to work correctly. Fluentd requires Ruby and some dependencies to operate. Run the following command in your terminal to install the required packages:

sudo apt-get install -y ruby-dev make build-essential libssl-dev zlib1g-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev libffi-dev

Step 2: Install Fluentd

The next step is to install Fluentd. To do this, follow the steps below:

  1. Install the GPG key for Fluentd:

    curl -sSL https://packages.treasuredata.com/GPG-KEY-td-agent | sudo apt-key add -
    
  2. Add Fluentd repository to the package source list:

    echo "deb https://packages.treasuredata.com/3/ubuntu/focal/ focal contrib" | sudo tee /etc/apt/sources.list.d/treasure-data.list
    

    Note: Replace "focal" with your Elementary OS latest release codename

  3. Update the package list:

    sudo apt-get update
    
  4. Install Fluentd:

    sudo apt-get install -y td-agent
    

Step 3: Start and Verify Fluentd

To start Fluentd, run the following command in Terminal:

sudo systemctl start td-agent

After starting Fluentd, verify the status of Fluentd by running:

sudo systemctl status td-agent

If Fluentd is running correctly, you should see output similar to this:

● td-agent.service - td-agent: Fluentd based data collector for Treasure Data
   Loaded: loaded (/lib/systemd/system/td-agent.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2021-09-23 14:44:17 CDT; 1min 33s ago
 Main PID: 18614 (ruby)
    Tasks: 2 (limit: 38373)
   Memory: 17.3M
      CPU: 756ms
   CGroup: /system.slice/td-agent.service
           └─18614 /opt/td-agent/embedded/bin/ruby /usr/sbin/td-agent --group td-agent --log /var/log/td-agent/td-agent.log --use-v1-config -...

Sep 23 14:44:16 user systemd[1]: Starting td-agent: Fluentd based data collector for Treasure Data...
Sep 23 14:44:17 user td-agent[18614]: [info]: parsing config file is succeeded path="/etc/td-agent/td-agent.conf"
Sep 23 14:44:17 user td-agent[18614]: [info]: using configuration file: <ROOT>
Sep 23 14:44:17 user td-agent[18614]: [info]: starting fluentd-1.7.4 pid=18646 ruby="2.7.4"
Sep 23 14:44:17 user systemd[1]: Started td-agent: Fluentd based data collector for Treasure Data.

Conclusion

Fluentd is now installed on your system, and you can start using it to collect logs from various sources. You can further configure Fluentd as per your requirements by editing the configuration file located at /etc/td-agent/td-agent.conf.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!