Advertisement
G0nz0uk

config.alloy v1

Nov 8th, 2024
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.51 KB | None | 0 0
  1. discovery.relabel "syslog" {
  2.     targets = []
  3.  
  4.     rule {
  5.         source_labels = ["__syslog_message_hostname"]
  6.         target_label  = "host"
  7.     }
  8.  
  9.     rule {
  10.         source_labels = ["__syslog_message_hostname"]
  11.         target_label  = "hostname"
  12.     }
  13.  
  14.     rule {
  15.         source_labels = ["__syslog_message_severity"]
  16.         target_label  = "level"
  17.     }
  18.  
  19.     rule {
  20.         source_labels = ["__syslog_message_app_name"]
  21.         target_label  = "application"
  22.     }
  23.  
  24.     rule {
  25.         source_labels = ["__syslog_message_facility"]
  26.         target_label  = "facility"
  27.     }
  28.  
  29.     rule {
  30.         source_labels = ["__syslog_connection_hostname"]
  31.         target_label  = "connection_hostname"
  32.     }
  33. }
  34.  
  35. loki.source.syslog "syslog" {
  36.     listener {
  37.         address      = "0.0.0.0:601"
  38.         protocol     = "tcp"
  39.         idle_timeout = "0s"
  40.         use_rfc5424_message = true
  41.         labels       = { job = "syslog", component = "loki.source.syslog", protocol = "tcp" }
  42.         max_message_length = 0
  43.     }
  44.     listener {
  45.         address      = "0.0.0.0:51893"
  46.         protocol     = "tcp"
  47.         idle_timeout = "0s"
  48.         use_rfc5424_message = true
  49.         labels       = { job = "syslog", component = "loki.source.syslog", protocol = "tcp" }
  50.         max_message_length = 0
  51.     }
  52.     forward_to    = [loki.write.syslog.receiver]
  53.     relabel_rules = discovery.relabel.syslog.rules
  54. }
  55.  
  56. loki.write "syslog" {
  57.     endpoint {
  58.         url = "http://x.x.x.x:3100/loki/api/v1/push"
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement