Skip to content

Commit

Permalink
modules (monitoring): Add scrape config for nextcloud-cron
Browse files Browse the repository at this point in the history
This unit is currently logging JSON, which is hard to read. This adds
promtail pipeline stages to extract JSON fields into labels and replace
the log line with the message field.
  • Loading branch information
britter committed Jul 3, 2024
1 parent fbcffa2 commit b7b6f13
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions modules/nixos/monitoring/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,53 @@ in {
target_label = "unit";
}
];
pipeline_stages = [
{
match = {
selector = "{unit=\"nextcloud-cron.service\"}";
stages = [
{
json = {
expressions = {
level = "level";
timestamp = "time";
message = "message";
request_id = "reqId";
remote_address = "remoteAddr";
user = "user";
app = "app";
method = "method";
url = "url";
user_agent = "userAgent";
version = "version";
data = "data";
};
};
}
{
labels = {
level = "";
timestamp = "";
request_id = "";
remote_address = "";
user = "";
app = "";
method = "";
url = "";
user_agent = "";
version = "";
data = "";
};
}
{
output = {
source = "message";
};
}
];
};
}
];
}
];
};
Expand Down

0 comments on commit b7b6f13

Please sign in to comment.