diff --git a/loki.hcl.tpl b/loki.hcl.tpl new file mode 100644 index 0000000..6206838 --- /dev/null +++ b/loki.hcl.tpl @@ -0,0 +1,46 @@ +auth_enabled: false + +server: + http_listen_port: 3100 + grpc_listen_port: 9096 + +common: + path_prefix: /tmp/loki + storage: + filesystem: + chunks_directory: /tmp/loki/chunks + rules_directory: /tmp/loki/rules + replication_factor: 1 + ring: + instance_addr: 127.0.0.1 + kvstore: + store: consul + consul: + host: localhost:8500 + + +schema_config: + configs: + - from: 2020-10-24 + store: boltdb-shipper + object_store: filesystem + schema: v11 + 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/usagestats/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/loki.nomad b/loki.nomad new file mode 100644 index 0000000..54977ac --- /dev/null +++ b/loki.nomad @@ -0,0 +1,72 @@ +variable "loki_version" { + type = string + default = "v2.5.0" + description = "Loki release to deploy. See https://github.com/grafana/loki/releases/" +} +job "loki" { + datacenters = ["dc1"] + type = "service" + name = "loki" + // migrate {} + priority = 80 + group "log-server" { + network { + port "loki_http_listen" { + static = 3100 + } + port "loki_grpc_listen" { + static = 9096 + } + port "promtail_http_listen" { + static = 9080 + } + port "promtail_grpc_listen" { + static = 0 + } + } + service { + name = "loki-http-server" + tags = ["logs", "loki", "observability"] + port = "loki_http_listen" + + check { + name = "loki_http_alive" + type = "tcp" + interval = "10s" + timeout = "3s" + } + } + task "server" { + driver = "raw_exec" + config { + command = "loki" + args = [ + "-config.file=local/loki.yml" + ] + } + template { + source = "local/loki.yml.tpl" + destination = "local/loki.yml" + } + // artifact { + // source = "https://github.com/grafana/loki/releases/download/${var.loki_version}/loki-linux-${attr.cpu.arch}.zip" + // options { # checksum depends on the cpu arch + // } + // destination = "local/loki" + // mode = "file" + // } + artifact { + source = "http://minio-deploy-run.service.consul:9000/loki-bin/loki-linux-${attr.cpu.arch}.zip" + destination = "local/loki" + mode = "file" + } + artifact { + source = "http://minio-deploy-run.service.consul:9000/loki-config/loki.hcl.tpl" + destination = "local/loki.yml.tpl" + mode = "file" + } + + } + + } +}