"Complete Guide: Installing Grafana, Loki, and Promtail for Powerful Log Monitoring and Visualization"

"Complete Guide: Installing Grafana, Loki, and Promtail for Powerful Log Monitoring and Visualization"

Table of contents

No heading

No headings in the article.

This article will focus on how to install Grafana, Loki, and Promtail and the monitoring part will be on the other article link will be provided below do checkout:

First, we will launch an EC2 Instance on AWS Console

Next, connect the instance through ssh - copy the ssh command

Open the terminal in your download folder where the pem file is downloaded and type the command sudo and paste the ssh command long with it

To install Grafana, loki, and promtail we can use the google docs file provided by Shubham Londhe for easy installation.

LINK:https://docs.google.com/document/d/1kHhk2LYss_c2pbBCCSXo4sqaqwNF3bj_MIiqm8L5b1U/edit

Next, copy the grafana required tools command and paste it into your terminal

Next, copy the stable release garfana key and run it into your terminal

Next, after installing grafana required tools and key now we need to update our system and run the command to install grafana

sudo apt-get update && sudo apt-get install grafana

After installation, we need to start and enable Grafana through systemctl

Now we need to add port 3000 because Grafana runs on it - go to your instance security group - inbound rules and add port 3000 - And As sources I have put "My IP"

To access Grafana - copy the instance Public IP address

And open it in a new tab and add port 3000 along with the IP address

As we can see the Grafana login page opens but requires to put username and password - here at first - "admin" is both the username and password by default

After login, you will be asked to enter a new password or you can skip but for any circumstances, it is advisable to add a password

After login in you will be able to see the Grafana home page

Now, when you click the 3 dash on the left of a home on the top left corner you will be able to see the administration panel, and on data sources, we can see "Loki" logging and document databases

Now to install Loki and promtail we just need to follow the Google docs

As Loki and promtail run on docker container, we need to install "Docker" first

Next, give the user docker permission by command - sudo usermod -aG docker USER

Next, create a folder named grafana configs for installing loki and promtail configs files here

Next, one by one copy and run the loki and promtail config commands in your terminal

By ls - list we can see both configs file is being downloaded

This is the loki config file:

And this is Promtail config file:

After config files next we run the docker container for both loki and promtail

Just copy and run the commands in your terminal one by one for both

As we show on Loki config file it listens to port 3100. So we need to add port 3100 in our Instance - same go for security group - inbound rules and add port 3100

Now to access Loki and logs, just copy the instance public IP address and open it in a new tab and add port 3100 along with metrics.

Ip-address:3100/metrics

You will be able to see the logs, but we want these logs to show on Grafana along with the visualization - we will look into it in the next article - the link is given below.

Run the docker ps command to see loki and promtail container

That's it for grafana installation along with loki and promtail.

Next, we will move to monitoring and visualization of the logs. The article link given below.

LINK: https://amitblog.hashnode.dev/effortless-log-monitoring-with-grafana-loki-and-promtail-visualize-and-analyze-your-logs-for-actionable-insights

Thank you for investing your time in reading the blogs!!!!