Skip to content

Commit

Permalink
Adding example for querying against Grafana Cloud log tenant in API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
lshippy committed Jan 4, 2024
1 parent ce57448 commit 5de95cf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/sources/reference/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,14 @@ curl -u "Tenant1|Tenant2|Tenant3:$API_TOKEN" \
--data-urlencode 'query=sum(rate({job="varlogs"}[10m])) by (level)' | jq
```


To query against your hosted log tenant in Grafana Cloud, use the **User** and **URL** values provided in the Loki logging service details of your Grafana Cloud stack. You can find this information in the [Cloud Portal](https://grafana.com/docs/grafana-cloud/account-management/cloud-portal/#your-grafana-cloud-stack). Use an access policy token in your queries for authentication. The password in this example is an access policy token that has been defined in the `API_TOKEN` environment variable:
```bash
curl -u "User:$API_TOKEN" \
-G -s "<URL-PROVIDED-IN-DATA-SOURCE-SETTINGS>/loki/api/v1/query" \
--data-urlencode 'query=sum(rate({job="varlogs"}[10m])) by (level)' | jq
```

## Query logs within a range of time

```
Expand Down

0 comments on commit 5de95cf

Please sign in to comment.