Monitoring Logs Of A New System
This page shows you how to scrap logs and push them to our ingestor
The provided script automates the deployment and configuration of the Promtail agent, which is used for log aggregation and forwarding to a Loki deployment. Here's a brief summary of how to use the script:
Review, download and run the promtail agent installer script:
wget https://gitlab.com/PBSA/infrastructure/devops-misc-issues/-/raw/main/scripts/loki/promtail-install.shAdd execute permissions and run the script:
sudo chmod +x promtail-install.sh && ./promtail-install.shSystem Update: The script begins with a system update, running:
apt updateandapt dist-upgradeto ensure the system is up to date.Promtail Installation: The script then downloads the Promtail binary from the official Grafana Loki repository, extracts it, and moves it to
/usr/local/bin/. It also verifies the version of Promtail.Configuration: The script creates the necessary directories for Promtail's configuration and data files (
/etc/promtailand/data/promtail). It then adds a default configuration file (config.yaml) for Promtail, which you need to edit with your specific settings.Systemd Service: The script sets up a systemd service file for Promtail (
/etc/systemd/system/promtail.service) to enable automatic start and management of the Promtail agent as a service.Configuration Reminder: The script reminds you to edit the
/etc/promtail/config.yamlfile with your specific configuration details before starting the Promtail agent.Starting and Checking Service: The script provides instructions for starting the Promtail agent using
sudo systemctl start promtail.serviceand checking the service's status withsystemctl status promtail.service.
Remember to review and update the configuration files with your desired settings to ensure Promtail is properly configured for your environment.
Last updated
