Skip to content

Create your first STACKIT Logs instance and send your first log messages

In this Getting started you will create an instance and configure it. This guide shows the most common settings for a small developer environment. When following this guide, you will work with the STACKIT Portal.

  1. Visit the STACKIT Portal.
  2. On the sidebar click on Logs.
  3. On the bar on the top click on Create Logs.

After completing the steps, you see an overlay with three sections (General information and Setup).

  • Enter the name for the instance.
  • Enter the retention days for the instance.

  • Add your clients IPv4 address to the list of ACLs.

    If you want to connect with the computer, with which you are browsing these docs, use Cloudflare’s IP trace tool to determine your IPv4 address. Open your browser of choice and visit the Cloudflare Trace Tool. Copy the value behind ip. It should look like xxx.xxx.xxx.xxx. Now append /32 to it and add it as ACL entry. To do so, click on Add IP Range and paste it in the field.

After reviewing every setting, click on Order fee-based to create your new instance. Then you will see a confirmation that your instance is created. Your new instance will be added to the list of instances. After a few minutes it will switch from Reconciling to Active.

Once the instance is Active:

  1. Click your Logs instance.

  2. Open the API tab.

  3. Open the Access tokens tab.

  4. Click Create access token.

  5. Enter Name.

  6. Select Unlimited lifetime.

  7. Select Role Read and Write.

  8. Click Create.

  9. Store the Token at a secure space.

You will need these for API access and Promtail/Grafana Agents.

You can send logs via REST API, Promtail, Grafana Agent, or third-party tools.

Below are examples using the Loki API.

ParameterMeaningExample
InstanceIdThe instance id of your Logs instance.e074181e-5a2c-4515-9980-af03bee08922
AccessTokenThe access token you just createdeyJhbGc…
AppNameThe name of you app in Lokidemo-app
TimestampThe start timespan of logs1763294137000000000
Terminal window
curl
-X POST https://[InstanceId].logs.eu01.onstackit.cloud/loki/api/v1/push \
-H "Content-Type: application/json" \
-H "Authorization: Bearer [AccessToken]" \
--data '{
"streams": [
{
"stream": {
"app": "[AppName]",
"level": "info"
},
"values": [
[ [Timestamp], "Hello from STACKIT Logs!" ]
]
}
]
}'

You should get a 204 No Content Response.

ParameterMeaningExample
InstanceIdThe instance id of your Logs instance.e074181e-5a2c-4515-9980-af03bee08922
AccessTokenThe access token you just createdeyJhbGc…
AppNameThe name of you app in Lokidemo-app
StartThe start timespan of logs1763294136000000000
EndThe end timespan of logs1763294138000000000
Terminal window
curl
-X POST https://[InstanceId].logs.eu01.onstackit.cloud/loki/api/v1/query_range?query={app="[AppName]"}&end=[End]&start=[Start] \
-H "Authorization: Bearer [AccessToken]"

Logs should answer with the logs which is similar to:

Terminal window
{
"status": "success",
"data": {
"resultType": "streams",
"result": [
{
"stream": {
"app": "demo-app",
"detected_level": "info",
"level": "info",
"service_name": "demo-app"
},
"values": [
[
"1763294137000000000",
"Hello from STACKIT Logs!"
]
]
}
],
[...]
}
}