make loki, promtail better
(better indices and so on)
This commit is contained in:
parent
f328d740e0
commit
5fbe52eb11
8 changed files with 81 additions and 19 deletions
nixos/components/monitor
|
@ -46,16 +46,49 @@ in
|
|||
{
|
||||
job_name = "journal";
|
||||
journal = {
|
||||
json = true;
|
||||
max_age = "12h";
|
||||
labels.job = "systemd-journal";
|
||||
};
|
||||
relabel_configs = [
|
||||
pipeline_stages = [
|
||||
{
|
||||
source_labels = [ "__journal__systemd_unit" ];
|
||||
target_label = "unit";
|
||||
json.expressions = {
|
||||
transport = "_TRANSPORT";
|
||||
unit = "_SYSTEMD_UNIT";
|
||||
msg = "MESSAGE";
|
||||
coredump_cgroup = "COREDUMP_CGROUP";
|
||||
coredump_exe = "COREDUMP_EXE";
|
||||
coredump_cmdline = "COREDUMP_CMDLINE";
|
||||
coredump_uid = "COREDUMP_UID";
|
||||
coredump_gid = "COREDUMP_GID";
|
||||
};
|
||||
}
|
||||
{
|
||||
source_labels = [ "__journal__transport" ];
|
||||
target_label = "transport";
|
||||
# Set the unit (defaulting to the transport like audit and kernel)
|
||||
template = {
|
||||
source = "unit";
|
||||
template = "{{if .unit}}{{.unit}}{{else}}{{.transport}}{{end}}";
|
||||
};
|
||||
}
|
||||
{ labels.coredump_unit = "coredump_unit"; }
|
||||
{
|
||||
# Normalize session IDs (session-1234.scope -> session.scope) to limit number of label values
|
||||
replace = {
|
||||
source = "unit";
|
||||
expression = "^(session-\\d+.scope)$";
|
||||
replace = "session.scope";
|
||||
};
|
||||
}
|
||||
{ labels.unit = "unit"; }
|
||||
{
|
||||
# Write the proper message instead of JSON
|
||||
output.source = "msg";
|
||||
}
|
||||
];
|
||||
relabel_configs = [
|
||||
{
|
||||
source_labels = [ "__journal__hostname" ];
|
||||
target_label = "instance";
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue