# Better Stack Fly.io logging

## Start logging in 2 minutes

### 1. Install

Start the official [Fly log shipper](https://github.com/superfly/fly-log-shipper) using the [Fly.io CLI](https://fly.io/docs/flyctl/):

```sh
[label Launch log shipper]
fly launch --no-deploy --image flyio/log-shipper:latest
```

[info]
#### Don't have Fly.io CLI?

Install `flyctl` using the [official instructions](https://fly.io/docs/flyctl/install/).
[/info]

### 2. Configure port 

Specify port in services configuration in the `fly.toml` config. Replace the whole `[http_service]` section with following configuration:

```toml
[label fly.toml]
[[services]]
  http_checks = []
  internal_port = 8686
```

### 3. Set up secrets

Set correct tokens and ingesting host:

```sh
[label Set secrets]
# You can find your organizations' slugs with "fly orgs list"
ORGANIZATION_SLUG=personal
fly secrets set ORG=$ORGANIZATION_SLUG
fly secrets set ACCESS_TOKEN=$(fly tokens create readonly $ORGANIZATION_SLUG | cut -d' ' -f2)
fly secrets set BETTER_STACK_SOURCE_TOKEN=$SOURCE_TOKEN
fly secrets set BETTER_STACK_INGESTING_HOST=$INGESTING_HOST
```

### 4. Deploy

Finally, run the log shipper:

```sh
[label Deploy log shipper]
fly deploy
```

You should see your logs in [Better Stack → Live tail](https://telemetry.betterstack.com/team/0/tail ";_blank").


## Need help?

Please let us know at hello@betterstack.com.  
We're happy to help! 🙏
