@version:3.24
@include "scl.conf"

options {
	chain_hostnames(off); keep-timestamp(yes); keep-hostname(yes);
	threaded(yes); time_reopen(5); use-dns(no); dns-cache(no);
	};

# mikrotik-syslog
#	network(ip("0.0.0.0") port(20514) transport(udp));
source mikrotiksyslog {
	syslog(ip("0.0.0.0") port(20514) transport(udp));
	};

# dhcp
source dhcpsyslog {
	network(ip("0.0.0.0") port(20515) transport(udp));
	};

# dhcp
source dhcpsyslog6 {
	network(ip("0.0.0.0") port(20516) transport(udp));
	};

source s_local { internal(); };

filter f_dhcp_msg {
	message("PORTAXLEASEACK");
	};

destination d_dhcp {
	file("/var/log/dhcpd.log" perm(0644));
};

destination d_dhcp6_file {
	file("/var/log/dhcpd6.log" perm(0644));
};

destination d_dhcp6 {
	network("127.0.0.1" port(5143) transport(udp));
};

destination d_local {
	file("/var/log/syslog-ng.log");
};

destination d_portax_mt {
	network("127.0.0.1" port(5141) transport(udp) spoof-source(yes));
};

destination d_portax_dhcp6_redis {
	redis(
		host("127.0.0.1")
		persist-name("redis-dhcp6")
		command("RPUSH", "dhcp6syslog", "${S_DATE}|${SOURCEIP}|${HOST}|${MSGHDR}${MESSAGE}")
	);
};

log {
	source(mikrotiksyslog);
	destination(d_portax_mt_redis);
};

log {
	source(dhcpsyslog); filter(f_dhcp_msg); destination(d_dhcp);
};

log {
	source(dhcpsyslog6); filter(f_dhcp_msg);
	destination(d_dhcp6_file);
	destination(d_portax_dhcp6_redis);
};

