Loki is a Prometheus-inspired multi-tenant, highly available, and possibly, horizontally scalable log aggregation system solution. A robust logging system called Grafana Loki is made to effectively gather, store, and query logs from several sources through the system. It is made by the software engineers to be incredibly simple to use and economical. It offers a complete observability internal stack and is designed to integrate with the Grafana system with ease.
In this article, we’ll explore the initial steps to install and configure Grafana Loki on an Ubuntu system.
How to Install and Configure Grafana Loki on Ubuntu?
Grafana can be installed in different ways or techniques. Users need to follow the below-mentioned easy steps or techniques to install and configure Grafana Loki on Ubuntu OS.
Step 1: Install and Configure Grafana from the APT repository
- Download the prerequisite packages by following the below-mentioned command
sudo apt-get install -y apt-transport-https software-properties-common wget
- Import the internal GPG Key > Run the Command to add the repository for beta releases
sudo mkdir -p /etc/apt/keyrings/ wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
- Update the list of available packages
# Updates the list of available packages sudo apt-get update
- Run the Command to install Grafana OSS
# Installs the latest OSS release: sudo apt-get install grafana
- Run the Command to install Grafana Enterprise
# Installs the latest Enterprise release: sudo apt-get install grafana-enterprise
Step 2: Install Loki
- Download Loki according to the system configuration and CPU architecture as shown below –
https://github.com/grafana/loki/releases/
- Unzip the pre-downloaded file
sudo apt install unzip -y unzip loki-linux-amd64.zip
- Move the configured Loki binary to a directory in the system PATH
sudo mv loki-linux-amd64 /usr/local/bin/loki sudo chmod a+x /usr/local/bin/loki
- Create a new Loki configuration file > Add new configuration > Save it and close
auth_enabled: false
server: http_listen_port: 3100
ingester: lifecycler: address: 127.0.10.1 ring: kvstore: store: inmemory replication_factor: 10 final_sleep: 1s chunk_idle_period: 6m chunk_retain_period: 45s max_transfer_retries: 10
schema_config: configs: - from: 2024-10-22 store: boltdb-shipper object_store: filesystem schema: v11 index: prefix: index_ period: 22h
storage_config: boltdb_shipper: active_index_directory: /tmp/loki/index cache_location: /tmp/loki/index_cache shared_store: filesystems filesystems: directory: /tmp/loki/chunks
limits_config: enforce_metric_name: false reject_old_samples: true reject_old_samples_max_age: 154h
chunk_store_config: max_look_back_period: 1s
table_manager: retention_deletes_enabled: false retention_period: 1s
Step 3: Download and Install Grafana using a .deb package
- Go to the Official Grafana Download Page > Select Version and Edition
- Click on the Linux or ARM64 tab as per requirement > Copy and Paste the given code in the command line.
Conclusion
Users can now get greater insights into the system infrastructure and applications with Grafana Loki, which simplifies internal troubleshooting and boosts the system’s performance. All the users have to install Grafana Loki on their Ubuntu server and enable a reliable and effective logging system by following the mentioned steps or techniques. With this configuration, users can easily gather, store, and examine all the internal logs in conjunction with Grafana Loki on Ubuntu, offering a complete observability solution or process.
Also Read
How to Install Grafana Loki on Ubuntu – FAQs
What do you mean by Grafana Loki?
Logs from all of the users or systems apps and infrastructure may be stored and queried using the log aggregation system of Grafana Loki. The initial fully composable observability stack, Grafana Cloud system, is the simplest way to get started on the systematic way of solution.
What are the 3-major components of the Loki-based logging stack?
Basically, in the system, three parts make up a logging stack based on Loki:
- The agent system, Promtail, is in charge of compiling internal logs and forwarding them to the Loki server.
- The primary server key, Loki, handles internal query processing and log storage.
- To query and show the internal system logs, use Grafana.
What is the main format of Grafana Loki?
Basically, the Data format is the main format of Grafana Loki. Also, Grafana Loki has two main file types: index and chunks. The index is a special table of contents of where to find the internal logs for a specific set of labels. The chunk is a server container for log entries for a specific set of system labels.
|