-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(promtail): add promtail job and configuration
Signed-off-by: Bruce Becker <[email protected]>
- Loading branch information
1 parent
b2aaccd
commit f449d2b
Showing
2 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# There can only be a single job definition per file. This job is named | ||
# "example" so it will create a job with the ID and Name "example". | ||
|
||
# The "job" stanza is the top-most configuration option in the job | ||
# specification. A job is a declarative specification of tasks that Nomad | ||
# should run. Jobs have a globally unique name, one or many task groups, which | ||
# are themselves collections of one or many tasks. | ||
# | ||
# For more information and examples on the "job" stanza, please see | ||
# the online documentation at: | ||
# | ||
# https://www.nomadproject.io/docs/job-specification/job | ||
# | ||
job "promtail" { | ||
datacenters = ["dc1"] | ||
type = "system" | ||
// constraint { | ||
// attribute = "${node.class}" | ||
// operator = "regexp" | ||
// value = "32|64" | ||
// } | ||
|
||
group "promtail" { | ||
count = 1 | ||
|
||
network { | ||
port "http" { | ||
static = 9080 | ||
} | ||
} | ||
|
||
service { | ||
name = "promtail" | ||
tags = ["logs", "promtail", "observability"] | ||
port = "http" | ||
|
||
check { | ||
name = "promtail-alive" | ||
type = "tcp" | ||
interval = "10s" | ||
timeout = "2s" | ||
} | ||
|
||
} | ||
|
||
restart { | ||
# The number of attempts to run the job within the specified interval. | ||
attempts = 2 | ||
interval = "30m" | ||
|
||
# The "delay" parameter specifies the duration to wait before restarting | ||
# a task after it has failed. | ||
delay = "15s" | ||
|
||
# The "mode" parameter controls what happens when a task has restarted | ||
# "attempts" times within the interval. "delay" mode delays the next | ||
# restart until the next interval. "fail" mode does not restart the task | ||
# if "attempts" has been hit within the interval. | ||
mode = "fail" | ||
} | ||
|
||
ephemeral_disk { | ||
size = 300 | ||
} | ||
|
||
task "promtail" { | ||
# The "driver" parameter specifies the task driver that should be used to | ||
# run the task. | ||
driver = "raw_exec" | ||
|
||
config { | ||
command = "promtail" | ||
args = ["-config.file=local/promtail.yml"] | ||
} | ||
|
||
artifact { | ||
source = "http://minio-deploy-run.service.consul:9000/loki-bin/promtail-linux-${attr.cpu.arch}.zip" | ||
destination = "local/promtail" | ||
mode = "file" | ||
} | ||
|
||
|
||
resources { | ||
cpu = 500 # 500 MHz | ||
memory = 256 # 256MB | ||
} | ||
|
||
|
||
template { | ||
data = file("promtail.yml.tpl") | ||
destination = "local/promtail.yml" | ||
change_mode = "signal" | ||
change_signal = "SIGHUP" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
server: | ||
http_listen_port: 9080 | ||
grpc_listen_port: 0 | ||
|
||
positions: | ||
filename: /tmp/positions.yaml | ||
|
||
clients: | ||
- url: http://loki-http-server.service.consul:3100/loki/api/v1/push | ||
|
||
scrape_configs: | ||
- job_name: system | ||
static_configs: | ||
- targets: | ||
- localhost | ||
labels: | ||
job: consul | ||
__path__: /var/log/consul*.log |