# Loki Logs

> Send data to Last9 using Grafana Loki’s recording rules’ remote write feature

Source: https://last9.io/docs/integrations/observability/loki-logs/

We make use of the Loki Ruler’s [remote-write](https://grafana.com/docs/loki/latest/alert/#remote-write) feature to allow Loki Ruler to write to an external remote endpoint i.e. Last9's remote-write endpoint.

## Prerequisites

Create a Last9 cluster by following [Getting Started](/docs/onboard/).

Keep the following information handy after creating the cluster:

- `$levitate_remote_write_url` - Last9's Remote write endpoint
- `$levitate_remote_write_username` - Cluster ID
- `$levitate_remote_write_password` - Write token created for the cluster

## Setup

![Grafana Loki to Last9](../../../../../../assets/content/docs/integrations/observability/logs/loki-logs/grafana-loki-levitate.png)

The setup is pretty straight forward. Grafana Loki has the required recording rules that are evaluated by the ruler component.

This ruler component has the ability to remote write the declared recording rules as metrics.

We need to configure the ruler component to remote write to Last9. This can be done as follows.

Update the existing Loki configuration to include the remote write config under the ruler section.

```yaml
ruler:
  ...
  remote_write:
    enabled: true
    client:
      url: "$levitate_remote_write_url"
      basic_auth:
        username: "$levitate_remote_write_username"
        password: "$levitate_remote_write_password"
```

After that, restart Loki, and data will be written to Last9.

Find more details on the remote write configurations [here](https://grafana.com/docs/loki/latest/operations/recording-rules/#remote-write)

## Next steps

Explore metric data using embedded Grafana by querying for the recording rule itself.

---

## Troubleshooting

Please get in touch with us on [Discord](https://discord.com/invite/Q3p2EEucx9)
or [Email](mailto:support@last9.io) if you have any questions.
