Last active
October 28, 2023 10:38
-
-
Save aruaam/f1ae9017c128b914ccaec0ac335332d7 to your computer and use it in GitHub Desktop.
How to configure the Grafana Flow agent on a Windows host with remote path storage
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
logging { | |
level = "info" | |
} | |
discovery.http "path_targets" { | |
url = "target_url_to_get_log_paths" | |
} | |
discovery.relabel "paths" { | |
targets = discovery.http.path_targets.targets | |
// Relabel for local.file_match component | |
rule { | |
source_labels = ["__address__"] | |
target_label = "__path__" | |
action = "replace" | |
} | |
// Drop unneeded labels | |
rule { | |
regex = "__meta_url" | |
action = "labeldrop" | |
} | |
rule { | |
regex = "__address__" | |
action = "labeldrop" | |
} | |
} | |
local.file_match "logs" { | |
path_targets = discovery.relabel.paths.output | |
} | |
loki.source.file "files" { | |
targets = local.file_match.logs.targets | |
forward_to = [loki.write.loki.receiver] | |
} | |
loki.write "loki" { | |
endpoint { | |
url = "http://loki_server:3100/loki/api/v1/push" | |
} | |
} | |
/* JSON response which should be returned to discovery.http component | |
[ | |
{ | |
"targets": [ | |
"C:/folder_1/logs/*.log", | |
"C:/folder_2/logs/app_1/main/*.log", | |
"D:/folder_3/*.log" | |
] | |
} | |
] | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Took me a while to figure out this one.