iptables之日志利器-ULOGD使用手记
ULOGD - the Userspace Logging
Daemon
引用一段作者的原话:
Harald Welte
<laforge@gnumonks.org>
http://www.gnumonks.org/gnumonks/pr..._details?p_id=1
This
packages is intended for passing packets from the kernel to userspace
to do
some logging there. It should work like that:
- Register a target called
ULOG with iptables
- if the target is hit:
- send the packet out using
netlink multicast facility
- return NF_CONTINUE immediately
New with
ipt_ULOG 0.8 we can accumulate packets in userspace and send
them in small
batches (1-50) to userspace. This reduces the amount of
expensive context
switches.
More than one logging daemon may listen to the netlink
multicast
address.
当我们在使用iptables配合LOG使用的时候,总感觉有些凌乱,因为里面啥都有,可我们只需要其中的一部分而已,并且从众多LOG中提取出的有用的记录,并且还要有效地组织起来还得真费一番脑筋,假如要是能把这些记录都存进数据库,那就好办了,于是查看iptables文档,发现了ULOG这个利器,以下就是我在安装,使用过程中的一点心得体会,希望能给有这需要的兄弟提供一点便利,当作抛砖引玉吧!
ULOG可以在用户空间记录被匹配的包的信息,这些信息和整个包都会通过netlink
socket被多播。然后,一个或多个用户空间的进程就会接受它们。换句话说,ULOG是至今iptables和Netfilter下最成熟、最完善的日志工具,它包含了很多更好的工具用于包的记录。这个target可以是我们把信息记录到MySQL或其他数据库中。这