Различия
Показаны различия между двумя версиями страницы.
| Следующая версия | Предыдущая версия | ||
| router:syslog-ng [2025/12/06 01:31] – создано mirocow | router:syslog-ng [2025/12/06 03:31] (текущий) – mirocow | ||
|---|---|---|---|
| Строка 3: | Строка 3: | ||
| ====== Scribe ====== | ====== Scribe ====== | ||
| + | * https:// | ||
| + | * https:// | ||
| + | |||
| + | <note tip>< | ||
| + | RFC3164 Network/ | ||
| + | Promtail (port 1514) -> Loki (port 3100) <- Grafana (port 3000) | ||
| + | </ | ||
| + | |||
| + | * Syslog-ng — принимать логи по сети от других устройств и систем. | ||
| + | * Loki — обрабатывать логи и отправлять их в Grafana для визуализации. | ||
| + | * Grafana — визуализировать логи, собранные с помощью Loki. | ||
| + | |||
| + | Важно, что Syslog-ng, Loki и Grafana могут быть на одном сервере для оптимальной производительности, | ||
| + | |||
| + | Настроить приём логов от устройств, | ||
| + | Настроить отправку логов на удалённый сервер, | ||
| ===== Подготовка ===== | ===== Подготовка ===== | ||
| Строка 15: | Строка 31: | ||
| <code bash> | <code bash> | ||
| $ / | $ / | ||
| + | </ | ||
| + | |||
| + | ===== Настройка ===== | ||
| + | |||
| + | nano / | ||
| + | <code bash> | ||
| + | ############################################################################# | ||
| + | # syslog-ng.conf customized for scribe on Asuswrt-Merlin firmware | ||
| + | # compare to / | ||
| + | # | ||
| + | # syslog-ng documentation: | ||
| + | # | ||
| + | # Release notes: https:// | ||
| + | |||
| + | @version: 4.7 | ||
| + | #@include " | ||
| + | @include "/ | ||
| + | |||
| + | options { | ||
| + | chain_hostnames(no); | ||
| + | create_dirs(yes); | ||
| + | keep_hostname(yes); | ||
| + | log_fifo_size(256); | ||
| + | log_msg_size(16384); | ||
| + | stats(freq(21600)); | ||
| + | flush_lines(0); | ||
| + | use_fqdn(no); | ||
| + | }; | ||
| + | |||
| + | # syslog-ng gets messages from the system, kernel, and syslog-ng (internal) | ||
| + | # DO NOT use system() source; causes issues on HND routers | ||
| + | # so_rcvbuf = maximum number of messages per second * 1024 | ||
| + | source src { | ||
| + | unix-dgram("/ | ||
| + | file("/ | ||
| + | internal(); | ||
| + | # udp(ip(192.168.x.y) port(514)); # uncomment this line to pass all network messages through syslog-ng filters | ||
| + | }; | ||
| + | |||
| + | # if you only want to pass network messages through some syslog-ng filters, uncomment the source line below | ||
| + | # then add " | ||
| + | #source net { udp(ip(192.168.x.y) port(514)); }; | ||
| + | |||
| + | # set the filename for the default log file - anything not filtered out will end up here | ||
| + | destination messages { file("/ | ||
| + | |||
| + | # to send log messages to the local network, uncomment the destination line below | ||
| + | # then add " | ||
| + | # | ||
| + | |||
| + | log { | ||
| + | source(src); | ||
| + | # source(net); | ||
| + | destination(messages); | ||
| + | # destination(log_server); | ||
| + | }; | ||
| + | </ | ||
| + | |||
| + | меняем функцию log на | ||
| + | |||
| + | <code bash> | ||
| + | destination d_fluentbit { | ||
| + | syslog(" | ||
| + | }; | ||
| + | |||
| + | log { | ||
| + | source(src); | ||
| + | # source(net); | ||
| + | destination(messages); | ||
| + | # destination(log_server); | ||
| + | destination(d_fluentbit); | ||
| + | }; | ||
| </ | </ | ||