How To Install python-graypy on Ubuntu 18.04

In this tutorial we learn how to install python-graypy on Ubuntu 18.04. python-graypy is Python logging handler that sends messages in GELF (Python 2)

Introduction

In this tutorial we learn how to install python-graypy on Ubuntu 18.04.

What is python-graypy

python-graypy is:

This package can be used to sent messages to Graylog2 using a custom handler for the builtin logging library in the Graylog Extended Log Format (GELF).

Alternately, GELFRabbitHandler can be used to send messages to RabbitMQ. Your Graylog2 server needs to be configured to consume messages via AMQP then. This prevents log messages from being lost due to dropped UDP packets (GELFHandler sends messages to Graylog2 using UDP). You will need to configure RabbitMQ with a ‘gelf_log’ queue and bind it to the ’logging.gelf’ exchange so messages are properly routed to a queue that can be consumed by Graylog2 (the queue and exchange names may be customized to your liking).

graypy can be easily integrated into Django’s logging settings.

This is the Python 2 version of the package.

There are three methods to install python-graypy on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python-graypy Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install python-graypy using apt-get by running the following command:

sudo apt-get -y install python-graypy

Install python-graypy Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install python-graypy using apt by running the following command:

sudo apt -y install python-graypy

Install python-graypy Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install python-graypy using aptitude by running the following command:

sudo aptitude -y install python-graypy

How To Uninstall python-graypy on Ubuntu 18.04

To uninstall only the python-graypy package we can use the following command:

sudo apt-get remove python-graypy

Uninstall python-graypy And Its Dependencies

To uninstall python-graypy and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove python-graypy

Remove python-graypy Configurations and Data

To remove python-graypy configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge python-graypy

Remove python-graypy configuration, data, and all of its dependencies

We can use the following command to remove python-graypy configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python-graypy

References

Summary

In this tutorial we learn how to install python-graypy package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.