← Back to Guides
Profile image for Dan Ambrose

By Dan Ambrose

Published 17th April 2023

Send logs to Loki on Grafana Cloud from Northflank

Sending your Northflank logs to Grafana Cloud or any self-hosted Loki instance is simple. This guide will take you through the steps to integrate your Loki instance with Northflank.

This guide is targeted at Grafana Cloud, but you can add a self-hosted instance of Loki by following similar steps. Specific considerations for self-hosted instances are noted at the end of the guide.

Create your API Key

Create your API key from the Grafana Cloud dashboard in your organisation. Your key needs the MetricsPublisher permission to allow Northflank to write log events.


Loki data source

Now you need to provide the correct authentication credentials, start by getting the username of your Loki instance by clicking on the Loki details button from your dashboard.

grafana-stack.png grafana-data-source.png

Create your Loki sink

Follow this link or navigate to the log sinks page in your team or user account settings and add a log sink.


Enter a recognisable name for the sink and select Loki as the sink type.

Fill in the fields with your corresponding information from Grafana Cloud, enter the URL and user from your Loki instance details. The password is your API key that you generated earlier.

By default, all logs from your account will be forwarded to Axiom. To target specific projects, open advanced options and specify which projects to forward logs from.

You can also enable custom label parsing if your application is configured to send additional keys in JSON-formatted log lines.

Finally click add log sink to create your Grafana Cloud Loki integration.

View your logs

Before your log sink is created, Northflank will send a log line to your Loki instance to verify the credentials are correct. This appears as a log line consisting of validating log sink credentials.

Go back to your cloud stack dashboard and click launch on Grafana.


Then click the Explore compass from the sidebar. Make sure to select Loki as your data source to query using the dropdown.


Using the Query Builder, you should see the Host label with value Northflank.


Logs from Northflank are labelled to help identify where log events come from so you can create queries and alerts for your Northflank hosted workloads.

A simple way to view all your logs from Northflank is to create a query with Host = “Northflank”.


Building queries

To find out more about the Loki Query Logs, look at the LogQL docs.

Self-hosted Loki

Make sure your Loki instance is publicly exposed and then create your log sink with your Loki endpoint.

By default Loki doesn't come with any native authentication for incoming HTTP requests. Northflank supports Basic HTTP authentication and will add your credentials to the request headers. This is left optional but is recommended.

Update your log sink

If you want to modify your sink after creation, navigate to the log sink list and click on the sink to view its details.

You can update the project targets and sink data as well as pause/resume the sink.

Have questions or feedback? You can always reach out to our team.

Share this article with your network