Розбіжності
Тут показані розбіжності між вибраною ревізією та поточною версією сторінки.
Порівняння попередніх версій Попередня ревізія Наступна ревізія | Попередня ревізія | ||
debian:syslog-ng [25/07/2024 14:21] – [A10 Thunder NAT logging] Method | debian:syslog-ng [25/07/2024 22:17] (поточний) – [Install Syslog-NG] Method | ||
---|---|---|---|
Рядок 1: | Рядок 1: | ||
====== Syslog-NG ====== | ====== Syslog-NG ====== | ||
+ | ===== Install Syslog-NG ===== | ||
<code bash> | <code bash> | ||
- | wget -qO - https:// | + | wget -qO - https:// |
- | echo "deb https:// | + | echo " |
apt update | apt update | ||
apt-get install syslog-ng-core syslog-ng-scl | apt-get install syslog-ng-core syslog-ng-scl | ||
</ | </ | ||
+ | |||
+ | test message from localhost | ||
+ | # logger --server 127.0.0.1 -p local0.info -t test "This is a test message" | ||
===== A10 Thunder NAT logging ===== | ===== A10 Thunder NAT logging ===== | ||
+ | |||
+ | ==== Syslog-NG server configuration for A10 ==== | ||
nano / | nano / | ||
- | <code perl|A10CGNat.conf> | + | <code perl> |
# Вхідні джерела | # Вхідні джерела | ||
source s_tcp_a10nat_log { | source s_tcp_a10nat_log { | ||
Рядок 18: | Рядок 25: | ||
}; | }; | ||
- | # Фільтр для перевірки наявності слова " | + | # Фільтр для перевірки наявності слова " |
filter f_a10nat_cgnat { | filter f_a10nat_cgnat { | ||
- | | + | |
}; | }; | ||
- | # Журнал на виході у форматі JSON | + | # Журнал на виході у форматі JSON. Основне призначення |
- | destination | + | destination |
file( | file( | ||
- | "/var/log/syslog-ng/ | + | "/nfs/ |
template(" | template(" | ||
create_dirs(yes) | create_dirs(yes) | ||
Рядок 32: | Рядок 39: | ||
}; | }; | ||
- | # Логічне об' | + | # Журнал на виході у форматі JSON. Запасне призначення |
+ | destination d_a10nat_json_backup { | ||
+ | file( | ||
+ | "/ | ||
+ | template(" | ||
+ | create_dirs(yes) | ||
+ | ); | ||
+ | }; | ||
+ | |||
+ | # Логічне об' | ||
log { | log { | ||
source(s_tcp_a10nat_log); | source(s_tcp_a10nat_log); | ||
filter(f_a10nat_cgnat); | filter(f_a10nat_cgnat); | ||
- | destination(d_a10nat_json); | + | destination(d_a10nat_json_main); |
flags(flow-control); | flags(flow-control); | ||
}; | }; | ||
+ | log { | ||
+ | source(s_tcp_a10nat_log); | ||
+ | filter(f_a10nat_cgnat); | ||
+ | destination(d_a10nat_json_backup); | ||
+ | when not exists("/ | ||
+ | flags(flow-control); | ||
+ | }; | ||
</ | </ | ||
systemctl restart syslog-ng | systemctl restart syslog-ng | ||
+ | | ||
+ | test message from remote linux host | ||
+ | # logger --server 172.16.0.37 --port 1515 --tcp --rfc3164 --tag NAT-TCP "This is a test message FROM nat" | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ==== A10 Thunder Configuration ==== | ||
+ | |||
+ | <code bash> | ||
+ | nat-0> | ||
+ | !Section configuration: | ||
+ | ! | ||
+ | cgnv6 server syslog1 172.16.0.37 | ||
+ | health-check-disable | ||
+ | port 1515 tcp | ||
+ | ! | ||
+ | |||
+ | cgnv6 service-group syslog tcp | ||
+ | member syslog1 1515 | ||
+ | ! | ||
+ | cgnv6 template logging lsn_logging | ||
+ | facility local7 | ||
+ | severity informational | ||
+ | batched-logging-disable | ||
+ | service-group syslog | ||
+ | source-address | ||
+ | ip 172.16.0.6 | ||
+ | disable-log-by-destination | ||
+ | icmp | ||
+ | ! | ||
+ | </ | ||
+ | |||
+ | ==== Скрипт міграції логів ==== | ||
+ | |||
+ | nano / | ||
+ | |||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | |||
+ | # Перевірка, | ||
+ | if mountpoint -q / | ||
+ | echo " | ||
+ | find / | ||
+ | find / | ||
+ | else | ||
+ | echo " | ||
+ | fi | ||
+ | </ | ||
+ | |||
+ | chmod +x / | ||
+ | crontab -e | ||
+ | |||
+ | <code bash> | ||
+ | */5 * * * * / | ||
+ | </ | ||
+ | |||