diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f8d545e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +loki-data +loki-wal diff --git a/compose.yml b/compose.yml index 788eccf..ef31911 100644 --- a/compose.yml +++ b/compose.yml @@ -116,6 +116,30 @@ services: networks: - teacinema + loki: + container_name: loki + image: grafana/loki:2.9.1 + volumes: + - ./loki-config.yml:/etc/loki/config.yaml + - ./loki-data:/loki + - ./loki-wal:/wal + command: + - -config.file=/etc/loki/config.yaml + ports: + - "3100:3100" + networks: + - teacinema + + promatail: + container_name: promtail + image: grafana/promtail:2.9.1 + volumes: + - ./promtail-config.yml:/etc/promtail/config.yml + - ../logs:/var/log/services + command: -config.file=/etc/promtail/config.yml + networks: + - teacinema + volumes: postgres_data: redis_data: diff --git a/loki-config.yml b/loki-config.yml new file mode 100644 index 0000000..bed05d9 --- /dev/null +++ b/loki-config.yml @@ -0,0 +1,41 @@ +auth_enabled: false + +server: + http_listen_port: 3100 + +ingester: + lifecycler: + address: 127.0.0.1 + ring: + kvstore: + store: inmemory + replication_factor: 1 + chunk_idle_period: 5m + max_chunk_age: 1h + +schema_config: + configs: + - from: 2020-10-24 + store: tsdb + object_store: filesystem + schema: v12 + index: + prefix: index_ + period: 24h + +storage_config: + tsdb_shipper: + active_index_directory: /loki/index + cache_location: /loki/cache + shared_store: filesystem + filesystem: + directory: /loki/chunks + +limits_config: + ingestion_rate_mb: 10 + ingestion_burst_size_mb: 20 + max_cache_freshness_per_query: 10m + +compactor: + working_directory: /loki/compactor + shared_store: filesystem diff --git a/promtail-config.yml b/promtail-config.yml new file mode 100644 index 0000000..7415b36 --- /dev/null +++ b/promtail-config.yml @@ -0,0 +1,18 @@ +server: + http_listen_port: 9080 + grpc_listen_port: 0 + +positions: + filename: /tmp/positions.yaml + +clients: + - url: http://loki:3100/loki/api/v1/push + +scrape_configs: + - job_name: auth-logs + static_configs: + - targets: [localhost] + labels: + job: auth + service: auth-service + __path__: /var/log/services/auth/*.log