Try Live Demo

Managing logs effectively is crucial for troubleshooting Ant Media Server in Kubernetes. This guide simplifies the process with centralized log management using Graylog and Fluent-Bit, ensuring you never lose critical debugging data again.

Why Centralized Log Management?

When Kubernetes pods fail unexpectedly, logs can vanish, complicating issue resolution. Centralized logging ensures all logs are securely stored and easily accessible, enhancing debugging efficiency.

In this solution, we will use Graylog and Fluent-Bit to store logs on a centralized server. Graylog will run on a separate node outside the Kubernetes cluster, while Fluent-Bit will collect logs from pods within the Kubernetes environment and forward them to Graylog. This approach will improve log management efficiency and make debugging easier.

Setting Up Graylog and OpenSearch

Graylog is a powerful tool for centralized log management, offering advanced filtering, indexing, and search capabilities. It will be integrated with OpenSearch for optimized log storage and analysis.

Installing Graylog and Components

1. Install Graylog:

Since the installation process can be complex, we have prepared a setup script for you. You can use this script to proceed or follow the official documentation to complete the installation.

Installation Script: GitHub Link

Access Graylog at http://your-server-ip:9000 after the installation.

Note: On the first login, you will encounter a screen asking for an htaccess username and password. You can find the credentials in the following file: /var/log/graylog-server/server.log

graylog log

After logging in, go to System > Input and create an input to forward logs to Graylog as follows:

2. Configure Graylog Inputs

  • GELF UDP > Launch New Input and select Global, then create the input.

graylog 2

Note: Don’t forget to open the following firewall ports:
UDP/12201
TCP/9000

Integrating Fluent-Bit with Kubernetes

Fluent-Bit, known for its lightweight and high-performance, is widely used in Kubernetes and Docker environments. It collects logs from Kubernetes pods and forwards them to Graylog seamlessly.

Installing and Configuring Fluent-Bit

1. Install Fluent-Bit:

Use our pre-configured values.yaml file to streamline installation. Update it with your Graylog server’s address and deploy it using Helm, and your logs will start streaming directly to Graylog.

helm repo add fluent https://fluent.github.io/helm-charts
helm upgrade --install fluent-bit fluent/fluent-bit -f ./fluentbit_values.yaml

After installation, you can verify that everything is running smoothly.

2. Verify Installation:

Check Fluent-Bit logs with:

kubectl logs fluent-bit

Ensure logs start appearing in Graylog at http://your-server-ip:9000.

If the logs are not appearing, please restart the Graylog service.

graylog 1

Utilizing Graylog

Once set up, Graylog allows detailed searches by pod name, namespace, IP address, or image name. Easily navigate logs and pinpoint issues quickly.

log management

Conclusion

With centralized log management powered by Graylog and Fluent-Bit, you’re equipped to handle any Ant Media Server issue effectively. Streamline your debugging process and keep your Kubernetes environment running smoothly.

If you have questions or need any support, contact us via a formschedule a meeting to have a coffee and chat, or write directly to contact@antmedia.io

Categories: Tutorial

Murat Ugur

Murat is a Software Developer and a Technical Support Engineer at the same time at Ant Media. With a remarkable 15+ years in the IT domain, including 13 years dedicated to Linux System administration, Murat brings a wealth of experience to the table. His expertise is grounded in technologies like bash scripting, python, and puppet.