Skip to content

Commit

Permalink
feat(logging): add loki server job
Browse files Browse the repository at this point in the history
Signed-off-by: Bruce Becker <[email protected]>
  • Loading branch information
brucellino committed Apr 25, 2022
1 parent d98e773 commit b2aaccd
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 0 deletions.
46 changes: 46 additions & 0 deletions loki.hcl.tpl
Original file line number Diff line number Diff line change
@@ -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
72 changes: 72 additions & 0 deletions loki.nomad
Original file line number Diff line number Diff line change
@@ -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"
}

}

}
}

0 comments on commit b2aaccd

Please sign in to comment.