Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logging to close #58 #60

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
43 changes: 42 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ services:
- "8080:8080"
volumes:
- /var/run/docker.sock:/var/run/docker.sock

postgres-timber:
container_name: pgres
image: "postgres"
Expand All @@ -33,6 +34,7 @@ services:
"-c",
"log_min_error_statement=ERROR",
]

redis-timber:
container_name: rdis
image: "redis:alpine"
Expand All @@ -42,6 +44,7 @@ services:
- "6379:6379"
volumes:
- "rdbdata_timber:/data"

timber-api:
command: modd
container_name: timber-api
Expand Down Expand Up @@ -78,6 +81,11 @@ services:
- postgres-timber
- redis-timber
- reverse-proxy
logging:
driver: json-file
options:
tag: "{{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}"

timber-client:
container_name: timber-client
build:
Expand All @@ -102,6 +110,39 @@ services:
volumes:
- ./ui:/app
- /app/node_modules

grafana:
image: grafana/grafana
container_name: grafana
ports:
- "3000:3000"
environment:
GF_SECURITY_ADMIN_PASSWORD: ADMIN1234
GF_SECURITY_ADMIN_USER: ADMIN
GF_AUTH_ANONYMOUS_ENABLED: false
GF_AUTH_ANONYMOUS_ORG_ROLE: Viewer
GF_AUTH_ANONYMOUS_ORG_NAME: Public

loki:
image: grafana/loki:2.3.0
container_name: loki
ports:
- "3100:3100"
command: "--config.file=/etc/loki/loki.yml"
volumes:
- ./loki:/etc/loki

promtail:
image: grafana/promtail
container_name: promtail
ports:
- "9090:9090"
command: "--config.file=/etc/promtail/promtail.yml"
volumes:
- ./promtail:/etc/promtail
- /var/lib/docker:/var/lib/docker:ro


volumes:
pgdata_timber:
rdbdata_timber:
rdbdata_timber:
55 changes: 55 additions & 0 deletions loki/loki.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
auth_enabled: false

server:
http_listen_port: 3100
log_level: error

ingester:
lifecycler:
address: 127.0.0.1
ring:
kvstore:
store: inmemory
replication_factor: 1
final_sleep: 0s
chunk_idle_period: 5m
chunk_retain_period: 30s

schema_config:
configs:
- from: 2021-11-09
store: boltdb
object_store: filesystem
schema: v9
index:
prefix: index_
period: 168h

storage_config:
boltdb:
directory: /tmp/loki/index

filesystem:
directory: /tmp/loki/chunks

limits_config:
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 168h

chunk_store_config:
max_look_back_period: 0

table_manager:
chunk_tables_provisioning:
inactive_read_throughput: 0
inactive_write_throughput: 0
provisioned_read_throughput: 0
provisioned_write_throughput: 0
index_tables_provisioning:
inactive_read_throughput: 0
inactive_write_throughput: 0
provisioned_read_throughput: 0
provisioned_write_throughput: 0
retention_deletes_enabled: false
retention_period: 0
43 changes: 43 additions & 0 deletions promtail/promtail.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
server:
http_listen_address: 0.0.0.0
http_listen_port: 9080

positions:
filename: /tmp/positions.yaml

clients:
- url: http://loki:3100/loki/api/v1/push

scrape_configs:
- job_name: docker
static_configs:
- targets:
- localhost
labels:
job: dockerlogs
__path__: /var/lib/docker/containers/*/*log
pipeline_stages:
- json:
expressions:
output: log
stream: stream
attrs:
- json:
expressions:
tag:
source: attrs
- regex:
expression: (?P<image_name>(?:[^|]*[^|])).(?P<container_name>(?:[^|]*[^|])).(?P<image_id>(?:[^|]*[^|])).(?P<container_id>(?:[^|]*[^|]))
source: tag
- timestamp:
format: RFC3339Nano
source: time
- labels:
tag:
stream:
image_name:
container_name:
image_id:
container_id:
- output:
source: output