Get your Grafana Cloud credentials:
Encode your credentials (replace token with your actual token):
Create a bootstrap access policy with accesspolicies:read, accesspolicies:write, accesspolicies:delete scopes for your organization realm, then use its token:
POLICY_RESPONSE=$(curl -s -X POST -H "Authorization: Bearer YOUR_BOOTSTRAP_TOKEN" -H "Content-Type: application/json" -d '{"name":"zato-otlp-test","displayName":"Zato OTLP","scopes":["metrics:write","logs:write","traces:write"],"realms":[{"type":"stack","identifier":"1107449"}]}' "https://www.grafana.com/api/v1/accesspolicies?region=prod-us-east-0") && ACCESS_POLICY_ID=$(echo "$POLICY_RESPONSE" | jq -r '.id') && echo "Access Policy ID: $ACCESS_POLICY_ID"
TOKEN_RESPONSE=$(curl -s -X POST -H "Authorization: Bearer YOUR_BOOTSTRAP_TOKEN" -H "Content-Type: application/json" -d '{"accessPolicyId":"'$ACCESS_POLICY_ID'","name":"zato-token-test","displayName":"Zato Token"}' "https://www.grafana.com/api/v1/tokens?region=prod-us-east-0") && OTLP_TOKEN=$(echo "$TOKEN_RESPONSE" | jq -r '.token') && echo "Token: $OTLP_TOKEN"
Create systemd override file:
Add environment variables:
[Service]
Environment="Zato_Grafana_Cloud_OTLP_Endpoint=https://otlp-gateway-prod-us-east-0.grafana.net/otlp"
Environment="Zato_Grafana_Cloud_Auth=your-base64-encoded-credentials"
Replace your-base64-encoded-credentials with the output from the base64 command above.
Save and exit.
Restart the collector:
After traces are sent successfully: