# How to setup Fly log shipper with Loki on Grafana Cloud

**URL:** <https://community.fly.io/t/how-to-setup-fly-log-shipper-with-loki-on-grafana-cloud/5829>\
**Category:** General\
**Created:** [June 30, 2022, 10:19pm UTC](https://community.fly.io/t/how-to-setup-fly-log-shipper-with-loki-on-grafana-cloud/5829 "2022-06-30T22:19:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreyuhai](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/andreyuhai/32/36100_2.png) [@andreyuhai](https://community.fly.io/u/andreyuhai)\
**Post date:** [June 30, 2022, 10:19pm UTC](https://community.fly.io/t/how-to-setup-fly-log-shipper-with-loki-on-grafana-cloud/5829/1 "2022-06-30T22:19:45Z")

</div>

I’m trying to ship my logs to Loki on Grafana Cloud and I’ve set appropriate secrets however when the app is deployed I get 👇

```auto
 2022-06-30T22:04:40.625 app[c0ae4e53] lhr [info] 2022-06-30T22:04:40.625077Z ERROR sink{component_kind="sink" component_id=loki component_type=loki component_name=loki}:request{request_id=377}: vector_core::stream::driver: Service call failed. error=ServerError { code: 401 } request_id=377 

```

I am not sure whether I am using the incorrect fields but this is how I set

`LOKI_URL`  
`LOKI_USERNAME`  
`LOKI_PASSWORD`

 ![Screenshot 2022-07-01 at 00.15.20](https://global.discourse-cdn.com/fly1/original/3X/9/7/9768c7ff750f079f757d0ffcd9fe2416b5209282.png)

```auto
╰─$ fly secrets list
Update available 0.0.337 -> v0.0.344.
Run "fly version update" to upgrade.
NAME DIGEST DATE
ACCESS_TOKEN 02d262b881dfd9a06676f01481f35e8e 41m47s ago
LOKI_PASSWORD 99e3ec3204758aa99b9232b9e79d0559 40m15s ago
LOKI_URL 3fb20236273198f381409943f86fd19a 41m2s ago
LOKI_USERNAME 0acc83719e674bd9f8ccbf5d9f7abfbf 40m36s ago
ORG 71f177c46a124b665934bca6f0149a02 42m32s ago

```

Could you please help me understand what’s wrong?

---

<div class="post-metadata">

**Author:** ![andreyuhai](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/andreyuhai/32/36100_2.png) [@andreyuhai](https://community.fly.io/u/andreyuhai)\
**Post date:** [June 30, 2022, 11:29pm UTC](https://community.fly.io/t/how-to-setup-fly-log-shipper-with-loki-on-grafana-cloud/5829/2 "2022-06-30T23:29:55Z")

</div>

Okay, `LOKI_PASSWORD` should be the API key generated as described [here](https://grafana.com/docs/grafana-cloud/reference/create-api-key/).

Role should be at least `MetricsPublisher`.

After that it just worked.
