From b059b02c3284bdb802e0fc2e586b71d0984b4363 Mon Sep 17 00:00:00 2001 From: sungil Date: Mon, 24 Jun 2024 06:01:52 +0000 Subject: [PATCH] user-logging: add loki for non-platform-logs as loki-user --- lma/base/resources.yaml | 84 ++++++++++++++++++++++++++++++++++++++- lma/base/site-values.yaml | 16 ++++++++ 2 files changed, 99 insertions(+), 1 deletion(-) diff --git a/lma/base/resources.yaml b/lma/base/resources.yaml index 80b2e86..4e827b3 100644 --- a/lma/base/resources.yaml +++ b/lma/base/resources.yaml @@ -748,7 +748,7 @@ spec: type: helmrepo repository: https://harbor.taco-cat.xyz/chartrepo/tks name: lma-addons - version: 1.8.7 + version: 1.9.0 origin: https://openinfradev.github.io/helm-repo releaseName: addons targetNamespace: lma @@ -762,6 +762,9 @@ spec: loki: enabled: true url: "loki-loki-distributed-gateway.lma" + lokiuser: + enabled: true + url: "loki-user-loki-distributed-gateway.lma" grafanaDashboard: include: - kubernetes @@ -1225,6 +1228,85 @@ spec: --- apiVersion: helm.fluxcd.io/v1 kind: HelmRelease +metadata: + labels: + name: loki-user + name: loki-user +spec: + helmVersion: v3 + chart: + type: helmrepo + repository: https://harbor.taco-cat.xyz/chartrepo/tks + name: loki-distributed + version: 0.58.0 + origin: https://grafana.github.io/helm-charts + releaseName: loki-user + targetNamespace: lma + values: + global: + clusterDomain: cluster.local # TO_BE_FIXED + dnsService: coredns + loki: + image: + registry: harbor.taco-cat.xyz + repository: tks/loki + tag: null + schemaConfig: + configs: + - from: "2020-09-07" + store: boltdb-shipper + object_store: s3 + schema: v11 + index: + prefix: loki_index_ + period: 24h + storageConfig: + boltdb_shipper: + active_index_directory: /var/loki/index + cache_location: /var/loki/cache + cache_ttl: 24h # Can be increased for faster performance over longer query periods, uses more disk space + shared_store: s3 + aws: + s3: TO_BE_FIXED + bucketnames: tks-loki-user + s3forcepathstyle: true + structuredConfig: + limits_config: + ingestion_rate_mb: 25 + ingestion_burst_size_mb: 50 + max_streams_per_user: 0 + max_global_streams_per_user: 0 + table_manager: + retention_deletes_enabled: true + retention_period: TO_BE_FIXED + serviceMonitor.enabled: true + prometheusRule.enabled: true + ingester: + resources: + limits: + cpu: '4' + memory: 4Gi + requests: + cpu: 100m + memory: 250Mi + persistence: + enabled: true + inMemory: false + size: 100Gi + memcachedExporter.enabled: true + gateway: + image: + registry: harbor.taco-cat.xyz + repository: tks/nginx-unprivileged + + nginxConfig: + httpSnippet: |- + client_max_body_size 50M; + serverSnippet: |- + client_max_body_size 50M; +--- +apiVersion: helm.fluxcd.io/v1 +kind: HelmRelease metadata: labels: name: lma-bucket diff --git a/lma/base/site-values.yaml b/lma/base/site-values.yaml index b9519e4..ee08b35 100644 --- a/lma/base/site-values.yaml +++ b/lma/base/site-values.yaml @@ -22,6 +22,8 @@ global: lokiHost: loki-loki-distributed-gateway lokiPort: 80 + lokiuserHost: loki-user-loki-distributed-gateway + lokiuserPort: 80 grafanaDatasourceMetric: lma-prometheus.lma:9090 charts: @@ -147,6 +149,7 @@ charts: grafanaDatasource.prometheus.url: $(grafanaDatasourceMetric) # grafanaDatasource.prometheus.url: "thanos-query.lma:9090" grafanaDatasource.loki.url: $(lokiHost):$(lokiPort) + grafanaDatasource.lokiuser.url: $(lokiuserHost):$(lokiuserPort) - name: prometheus-adapter override: @@ -173,11 +176,18 @@ charts: purge: false versioning: true objectlocking: false + - name: loki-user + policy: public + purge: false + versioning: true + objectlocking: false customCommands: - command: ilm rule add --expire-days 90 myminio/tks-thanos - command: ilm rule add --expire-days 15 myminio/tks-loki + - command: ilm rule add --expire-days 15 myminio/tks-loki-user - command: ilm ls myminio/tks-thanos - command: ilm ls myminio/tks-loki + - command: ilm ls myminio/tks-loki-user persistence.storageClass: $(storageClassName) persistence.accessMode: ReadWriteOnce persistence.size: 20Gi @@ -260,10 +270,16 @@ charts: loki.storageConfig.aws.s3: http://$(defaultUser):$(defaultPassword)@minio.lma.svc:9000/minio loki.structuredConfig.table_manager.retention_period: 672h # delete logs after 672h = 28 days +- name: loki-user + override: + loki.storageConfig.aws.s3: http://$(defaultUser):$(defaultPassword)@minio.lma.svc:9000/minio + loki.structuredConfig.table_manager.retention_period: 72h # delete logs after 72h = 3 days + - name: lma-bucket override: s3.enabled: true s3.buckets: - name: $(clusterName)-tks-thanos - name: $(clusterName)-tks-loki + - name: $(clusterName)-tks-loki-user # tks.iamRoles: arn:aws:iam::12345678:role/control-plane.cluster-api-provider-aws.sigs.k8s.io