View previous topic :: View next topic |
Author |
Message |
ee99ee2 Guru
Joined: 18 Jun 2002 Posts: 307 Location: Murfreesboro, TN, USA
|
Posted: Thu Oct 23, 2003 9:46 am Post subject: iptables logging |
|
|
Is there a way to have iptables log to something like /var/log/iptables? I know syslog is what does it, but is something like that possiable? I dunno much about the workings of syslog...
-ee99ee _________________ ServerMotion |
|
Back to top |
|
|
magnet Guru
Joined: 16 Mar 2003 Posts: 582 Location: france
|
Posted: Thu Oct 23, 2003 10:05 am Post subject: |
|
|
hello.
to log things with iptables, you'll need a kernel module ( CONFIG_IP_NF_TARGET_LOG ).
option related to logs are :
--log-prefix , to specify a prefix for data in the logs
--log-level , log's verbosity
a short exemple, how to log things that you DROP.
let's create a new chain :
Code: |
iptables -N LOG_DROP
|
now log things that we drop :
Code: |
iptables -A LOG_DROP -j LOG --log-prefix '[DROPPED] : '
|
then drop things that we drop :p
Code: |
iptables -A LOG_DROP -j DROP
|
now don t forget to use LOG_DROP instead of DROP.like
Code: |
iptables -A FORWARD -j LOG_DROP
iptables -A INPUT -j LOG_DROP
iptables -A OUTPUT -j LOG_DROP
|
_________________ every step aim at glory. |
|
Back to top |
|
|
nephros Advocate
Joined: 07 Feb 2003 Posts: 2139 Location: Graz, Austria (Europe - no kangaroos.)
|
Posted: Thu Oct 23, 2003 11:14 am Post subject: |
|
|
I think he meant how to log into a specified file instead of the syslog rather than how to log at all.
Isn't that what ULOG is for?
from the kernel help:
Quote: | CONFIG_IP_NF_TARGET_ULOG: This option adds a `ULOG' target, which allows ou to create rules in any iptables table. The packet is passed to a userspace logging daemon using netlink multicast sockets; unlike the LOG target whch can only be viewed through syslog.
The apropriate userspace logging daemon (ulogd) may be obtained from http://www.gnumonks.org/projects/ulogd
|
I never played with this though. _________________ Please put [SOLVED] in your topic if you are a moron. |
|
Back to top |
|
|
magnet Guru
Joined: 16 Mar 2003 Posts: 582 Location: france
|
Posted: Thu Oct 23, 2003 12:19 pm Post subject: |
|
|
oh
I shouldn t answer early in the morning ! _________________ every step aim at glory. |
|
Back to top |
|
|
ee99ee2 Guru
Joined: 18 Jun 2002 Posts: 307 Location: Murfreesboro, TN, USA
|
Posted: Thu Dec 11, 2003 7:24 am Post subject: |
|
|
Both answeres answered questions I had. Thanks!
-ee99ee _________________ ServerMotion |
|
Back to top |
|
|
ikaro Advocate
Joined: 14 Jul 2003 Posts: 2527 Location: Denmark
|
Posted: Thu Dec 11, 2003 8:56 am Post subject: |
|
|
I use ULOG with shorewall, and its great.
Easy to setup too. _________________ linux: #232767 |
|
Back to top |
|
|
b0fh Guru
Joined: 16 Jun 2003 Posts: 426
|
Posted: Fri Dec 26, 2003 6:26 pm Post subject: |
|
|
Yep, ulogd works nice, although I get masses of data
My mysql.log now reached nice 1,9GB because of ulogd inserting so much stuff... How can I prevent mysql to log every ulog event? Or would it be easier to simply wipe the log once a week? |
|
Back to top |
|
|
ikaro Advocate
Joined: 14 Jul 2003 Posts: 2527 Location: Denmark
|
Posted: Fri Dec 26, 2003 7:14 pm Post subject: |
|
|
ULOGD only logs the stuff you send at it.
you can 1) dont actiavete so much logs to be sent to ulogd, 2) cron to wipe the log once a week , like you sugested, evt, gzip the old log, make a newone, and next week wipe the gziped etc..etc.., just in case you need to go back and check something on the last weeks log. _________________ linux: #232767 |
|
Back to top |
|
|
b0fh Guru
Joined: 16 Jun 2003 Posts: 426
|
Posted: Fri Dec 26, 2003 7:19 pm Post subject: |
|
|
I'm trying to cycle logfiles via cron and savelog. But which signal does mysqld need to re-cycle it's logs? killall -HUP seems not to work. |
|
Back to top |
|
|
ikaro Advocate
Joined: 14 Jul 2003 Posts: 2527 Location: Denmark
|
Posted: Fri Dec 26, 2003 9:11 pm Post subject: |
|
|
im affraid i cant help you with mysql, my setup is with plain files.
sorry. _________________ linux: #232767 |
|
Back to top |
|
|
|