From a32ee86b2cf1ad4fcb439759552e5eb0b32598ef Mon Sep 17 00:00:00 2001 From: Dominik Date: Wed, 24 Jul 2024 21:51:43 +0200 Subject: [PATCH] grafana loki added --- grafana/config/loki-config.yaml | 57 +++++++++++++++++++ grafana/docker-compose.yml | 31 ++++++++++ grafana/provisioning/datasources/default.yaml | 11 ++++ grafana/provisioning/plugins/app.yaml | 12 ++++ 4 files changed, 111 insertions(+) create mode 100644 grafana/config/loki-config.yaml create mode 100644 grafana/docker-compose.yml create mode 100644 grafana/provisioning/datasources/default.yaml create mode 100644 grafana/provisioning/plugins/app.yaml diff --git a/grafana/config/loki-config.yaml b/grafana/config/loki-config.yaml new file mode 100644 index 0000000..ac281a8 --- /dev/null +++ b/grafana/config/loki-config.yaml @@ -0,0 +1,57 @@ +auth_enabled: false + +server: + http_listen_port: 3100 + grpc_listen_port: 9096 + +common: + instance_addr: 127.0.0.1 + path_prefix: /tmp/loki + storage: + filesystem: + chunks_directory: /tmp/loki/chunks + rules_directory: /tmp/loki/rules + replication_factor: 1 + ring: + kvstore: + store: inmemory +frontend: + max_outstanding_per_tenant: 2048 +pattern_ingester: + enabled: true +limits_config: + max_global_streams_per_user: 0 + ingestion_rate_mb: 50000 + ingestion_burst_size_mb: 50000 + volume_enabled: true +query_range: + results_cache: + cache: + embedded_cache: + enabled: true + max_size_mb: 100 + +schema_config: + configs: + - from: 2020-10-24 + store: tsdb + object_store: filesystem + schema: v13 + index: + prefix: index_ + period: 24h + +ruler: + alertmanager_url: http://localhost:9093 +# By default, Loki will send anonymous, but uniquely-identifiable usage and configuration +# analytics to Grafana Labs. These statistics are sent to https://stats.grafana.org/ +# +# Statistics help us better understand how Loki is used, and they show us performance +# levels for most users. This helps us prioritize features and documentation. +# For more information on what's sent, look at +# https://github.com/grafana/loki/blob/main/pkg/analytics/stats.go +# Refer to the buildReport method to see what goes into a report. +# +# If you would like to disable reporting, uncomment the following lines: +#analytics: +# reporting_enabled: false diff --git a/grafana/docker-compose.yml b/grafana/docker-compose.yml new file mode 100644 index 0000000..d43f920 --- /dev/null +++ b/grafana/docker-compose.yml @@ -0,0 +1,31 @@ +version: '3.0' + +services: + grafana: + image: grafana/grafana:11.0.0 + environment: + - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin + - GF_AUTH_ANONYMOUS_ENABLED=true + - GF_AUTH_BASIC_ENABLED=false + - GF_FEATURE_TOGGLES_ENABLE=accessControlOnCall lokiLogsDataplane + - GF_INSTALL_PLUGINS=https://storage.googleapis.com/integration-artifacts/grafana-lokiexplore-app/grafana-lokiexplore-app-latest.zip;grafana-lokiexplore-app + ports: + - 3000:3000/tcp + volumes: + - ./provisioning:/etc/grafana/provisioning + extra_hosts: + - 'host.docker.internal:host-gateway' + loki: + image: grafana/loki:main-e9b6ce9 + environment: + LOG_CLUSTER_DEPTH: '8' + LOG_SIM_TH: '0.3' + ports: + - '3100:3100' + volumes: + - ./config/loki-config.yaml:/etc/loki/local-config.yaml + command: -config.file=/etc/loki/local-config.yaml + restart: on-failure + generator: + image: us-docker.pkg.dev/grafanalabs-global/docker-explore-logs-prod/fake-log-generator:latest + command: -url http://loki:3100/loki/api/v1/push diff --git a/grafana/provisioning/datasources/default.yaml b/grafana/provisioning/datasources/default.yaml new file mode 100644 index 0000000..9414657 --- /dev/null +++ b/grafana/provisioning/datasources/default.yaml @@ -0,0 +1,11 @@ +apiVersion: 1 + +datasources: + - name: gdev-testdata + isDefault: false + type: testdata + - name: gdev-loki + type: loki + uid: gdev-loki + access: proxy + url: http://host.docker.internal:3100 \ No newline at end of file diff --git a/grafana/provisioning/plugins/app.yaml b/grafana/provisioning/plugins/app.yaml new file mode 100644 index 0000000..09568b9 --- /dev/null +++ b/grafana/provisioning/plugins/app.yaml @@ -0,0 +1,12 @@ +apiVersion: 1 + +apps: + - type: "grafana-lokiexplore-app" + org_id: 1 + org_name: "Grafana" + disabled: false + jsonData: + apiUrl: http://default-url.com + isApiKeySet: true + secureJsonData: + apiKey: secret-key