> For the complete documentation index, see [llms.txt](https://sre.peerplays.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sre.peerplays.com/introduction/service-level-agreements-slas/log-aggregation/monitoring-logs-of-a-new-system.md).

# Monitoring Logs Of A New System

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:

1. Review, download and run the *promtail* agent installer script:

```
wget https://gitlab.com/PBSA/infrastructure/devops-misc-issues/-/raw/main/scripts/loki/promtail-install.sh
```

2. Add execute permissions and run the script:&#x20;

```
sudo chmod +x promtail-install.sh && ./promtail-install.sh
```

3. System Update: The script begins with a system update, running:  `apt update` and `apt dist-upgrade` to ensure the system is up to date.
4. 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.
5. Configuration: The script creates the necessary directories for Promtail's configuration and data files (`/etc/promtail` and `/data/promtail`). It then adds a default configuration file (`config.yaml`) for Promtail, which you need to edit with your specific settings.
6. 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.
7. Configuration Reminder: The script reminds you to edit the `/etc/promtail/config.yaml` file with your specific configuration details before starting the Promtail agent.
8. Starting and Checking Service: The script provides instructions for starting the Promtail agent using `sudo systemctl start promtail.service` and checking the service's status with `systemctl status promtail.service`.

Remember to review and update the configuration files with your desired settings to ensure Promtail is properly configured for your environment.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sre.peerplays.com/introduction/service-level-agreements-slas/log-aggregation/monitoring-logs-of-a-new-system.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
