Setup ssh/promtail/loki for grafana ssh dashboard

This commit is contained in:
♥ Minnie ♥ 2024-06-13 21:37:38 +08:00
parent 18181f9085
commit 0b4ce24253
Signed by: jasmine
GPG key ID: 8563E358D4E8040E
4 changed files with 122 additions and 0 deletions

View file

@ -0,0 +1,31 @@
{ config, ... }:
{
services.promtail = {
enable = true;
configuration = {
server = {
http_listen_port = 9080;
grpc_listen_port = 0;
};
positions = {
filename = "/tmp/positions.yaml";
};
clients = [{
url = "http://127.0.0.1:${toString config.services.loki.configuration.server.http_listen_port}/loki/api/v1/push";
}];
scrape_configs = [{
job_name = "system";
static_configs = [{
targets = [ "localhost" ]; # Promtail target is localhost
labels = {
instance = "viridian.kanto.dev"; # Label identifier for instance
env = "kanto"; # Environment label
job = "secure"; # Job label
__path__ = "/var/log/sshd.log";
};
}];
}];
};
};
}