Skip to content

Commit

Permalink
fix(loki): use consul as distributor ring (#28)
Browse files Browse the repository at this point in the history
fix(loki): use consul as distributor ring

Signed-off-by: Bruce Becker <[email protected]>

fix(loki): provide working configuration for S3 object store on R2

Signed-off-by: Bruce Becker <[email protected]>

---------

Signed-off-by: Bruce Becker <[email protected]>
  • Loading branch information
brucellino authored Apr 23, 2023
1 parent d660fd0 commit 3ef384b
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 10 deletions.
28 changes: 22 additions & 6 deletions loki.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,21 @@ variable "loki_version" {
default = "v2.7.5"
}

variable "cloudflare_account_id" {
type = string
description = "Cloudflare Account ID if using r2"
}

variable "s3_access_key_id" {
type = string
description = "Access Key ID for S3 object storage"
}

variable "s3_secret_access_key" {
type = string
description = "Secret Access Key for S3 object storage"
}

job "loki" {
datacenters = ["dc1"]
type = "service"
Expand All @@ -28,12 +43,8 @@ job "loki" {
count = 1

network {
port "http" {
static = 3100
}
port "grpc" {
static = 9096
}
port "http" {}
port "grpc" {}
}
service {
name = "loki-http-server"
Expand Down Expand Up @@ -64,6 +75,11 @@ job "loki" {
"-config.file=local/loki.yml"
]
}
env {
s3_endpoint = var.cloudflare_account_id
access_key_id = var.s3_access_key_id
secret_access_key = var.s3_secret_access_key
}
resources {
cpu = 128
memory = 200
Expand Down
24 changes: 20 additions & 4 deletions loki.yml.tpl
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
auth_enabled: false

server:
http_listen_port: {{ env "NOMAD_PORT_http" }}
grpc_listen_port: {{ env "NOMAD_PORT_grpc" }}
register_instrumentation: true
http_server_read_timeout: "40s"
http_server_write_timeout: "50s"

{{/* distributor:
distributor:
ring:
kvstore:
store: consul
prefix: loki/collectors */}}
prefix: loki/collectors

ingester:
lifecycler:
Expand All @@ -27,9 +26,11 @@ ingester:
flush_op_timeout: 20m
schema_config:
configs:
{{/* store: boltdb-shipper
object_store: filesystem*/}}
- from: 2022-01-01
store: boltdb-shipper
object_store: filesystem
object_store: aws
schema: v11
index:
prefix: loki_
Expand All @@ -41,6 +42,21 @@ storage_config:
cache_location: local/index_cache
filesystem:
directory: local/index
aws:
bucketnames: hah-logs
endpoint: {{ env "s3_endpoint" }}.r2.cloudflarestorage.com
region: auto
access_key_id: {{ env "access_key_id" }}
secret_access_key: {{ env "secret_access_key" }}
insecure: false
sse_encryption: false
http_config:
idle_conn_timeout: 90s
insecure_skip_verify: false
s3forcepathstyle: true
dynamodb:
dynamodb_url: inmemory


limits_config:
enforce_metric_name: false
Expand Down

0 comments on commit 3ef384b

Please sign in to comment.