
By Dan Ambrose
Published 17th April 2023
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 from the Grafana Cloud dashboard in your organisation. Your key needs the MetricsPublisher
permission to allow Northflank to write log events.
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.
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.
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”
.
To find out more about the Loki Query Logs, look at the LogQL docs.
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.
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.