Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .env.sample
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
s3_basic_auth=
s3_basic_auth=

# Loki logging (local vs cloud)
# Local (default)
LOKI_ENDPOINT=http://loki:3100/loki/api/v1/push
LOKI_AUTH_HEADER=
GRAFANA_CLOUD_LOKI_USER=
GRAFANA_CLOUD_LOKI_API_KEY=

# Grafana Cloud Loki example (comment local values above and uncomment below)
# LOKI_ENDPOINT=https://logs-prod-012.grafana.net/loki/api/v1/push
# GRAFANA_CLOUD_LOKI_USER=123456
# GRAFANA_CLOUD_LOKI_API_KEY=glc_xxx
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,40 @@ This repo contains all subrepos of Hawk modules except Client SDKs (Catchers). I
2. Create `.env` file in those repositories where there is `.env.sample` file.
3. Run `docker-compose up` to run all hawk services or list only the necessary services in the command above.

## Logging (Loki + Grafana)

Grafana runs in Docker Compose and ships with a provisioned Logs dashboard that opens by default.

### Local Loki (default)

1. Copy `.env.sample` to `.env` (or update your existing `.env`) and keep the local values:

```
LOKI_ENDPOINT=http://loki:3100/loki/api/v1/push
LOKI_AUTH_HEADER=
GRAFANA_CLOUD_LOKI_USER=
GRAFANA_CLOUD_LOKI_API_KEY=
```

2. Start services: `docker-compose up`
3. Open Grafana: `http://localhost:3001`
User: `admin` Password: `admin`

### Grafana Cloud Loki

1. In `.env`, comment the local `LOKI_ENDPOINT` and set the cloud values:

```
# LOKI_ENDPOINT=http://loki:3100/loki/api/v1/push
LOKI_ENDPOINT=https://<your-cloud-host>/loki/api/v1/push
GRAFANA_CLOUD_LOKI_USER=<your_cloud_loki_user_id>
GRAFANA_CLOUD_LOKI_API_KEY=<your_api_key>
```

2. Start services: `docker-compose up`
3. Open Grafana: `http://localhost:3001`
User: `admin` Password: `admin`

## Troubleshooting

If something went wrong, check this items.
Expand Down
42 changes: 42 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,48 @@ services:
- 9091:9091
restart: unless-stopped

loki:
image: grafana/loki:2.9.5
ports:
- 3100:3100
volumes:
- ./loki/config/loki.yml:/etc/loki/loki.yml:ro
- ./loki/data:/loki
command:
- -config.file=/etc/loki/loki.yml
restart: unless-stopped

otel-collector:
image: otel/opentelemetry-collector-contrib:0.98.0
ports:
- 4317:4317
- 4318:4318
environment:
- LOKI_ENDPOINT=${LOKI_ENDPOINT}
- GRAFANA_CLOUD_LOKI_USER=${GRAFANA_CLOUD_LOKI_USER}
- GRAFANA_CLOUD_LOKI_API_KEY=${GRAFANA_CLOUD_LOKI_API_KEY}
volumes:
- ./loki/otel-collector/config.yml:/etc/otel-collector/config.yml:ro
command:
- --config=/etc/otel-collector/config.yml
restart: unless-stopped

grafana:
image: grafana/grafana:10.4.3
ports:
- 3001:3000
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=admin
- GF_USERS_DEFAULT_THEME=light
- GF_DASHBOARDS_DEFAULT_HOME_DASHBOARD_PATH=/etc/grafana/provisioning/dashboards/collector-logs.json
volumes:
- ./loki/grafana/provisioning:/etc/grafana/provisioning:ro
- ./loki/grafana/data:/var/lib/grafana
depends_on:
- loki
restart: unless-stopped

prometheus:
image: prom/prometheus
ports:
Expand Down
2 changes: 2 additions & 0 deletions loki/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
data/*
!data/.gitkeep
42 changes: 42 additions & 0 deletions loki/config/loki.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
auth_enabled: false

server:
http_listen_port: 3100
log_level: info

common:
path_prefix: /loki
replication_factor: 1
ring:
kvstore:
store: inmemory
storage:
filesystem:
chunks_directory: /loki/chunks
rules_directory: /loki/rules

schema_config:
configs:
- from: 2024-01-01
store: tsdb
object_store: filesystem
schema: v13
index:
prefix: index_
period: 24h

ingester:
wal:
dir: /loki/wal
lifecycler:
ring:
kvstore:
store: inmemory

compactor:
working_directory: /loki/compactor
retention_enabled: true
delete_request_store: filesystem

limits_config:
retention_period: 168h
1 change: 1 addition & 0 deletions loki/data/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 2 additions & 0 deletions loki/grafana/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
data/*
!data/.gitkeep
1 change: 1 addition & 0 deletions loki/grafana/data/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading