Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Jeffrey Laramie <JALaramie@Loudoun-Fairfax.com>
To: Stephen Smoogen <smoogen@lanl.gov>
Cc: akshaysalkar <akshaysalkar@indiatimes.com>,
	netfilter@lists.netfilter.org
Subject: Re: putting all logs in a file
Date: Wed, 10 Sep 2003 13:53:15 -0400	[thread overview]
Message-ID: <3F5F650B.3080404@Loudoun-Fairfax.com> (raw)
In-Reply-To: <1063208370.4771.30.camel@smoogen1.lanl.gov>

[-- Attachment #1: Type: text/plain, Size: 1671 bytes --]


>It should be use something like info and then put a line in syslog.conf
>for 
>
>kern.info /var/log/iptables
>

Ahhh, but this is the command he started with, and it logs to both files 
by default. I've wanted to do this for some time so I did a little 
hacking of syslog.conf file and here's what I've got so far:

1.   Log level "info" is used by the kernel pretty regularly, so I 
changed my iptables log levels to "debug". Since every kernel message 
with a log level of debug will show up in this file, I selected a log 
level that my system rarely uses. Your mileage may vary.

iptables . . .   -j LOG --log-level debug --log-prefix "your_prefix:"

2.   Add a statement in your syslog.conf file:

kern.=debug      -/var/log/iptables.log

This will send only kernel debug level messages to your file. If you 
don't use the "=" then all messages at debug level or higher 
(everything) will go to your file. The "-" before the log file name 
allows the system to delay logging to this file during times of heavy 
kernel load.

3.   Modify the syslog.conf line that points to your /var/log/messages 
file by adding "kern.!=debug" to exclude (only) debug messages. In my 
case the line now looks like this:

*.*;mail.none;news.none;kern.!=debug      -/var/log/messages

4.    Restart syslog (this may not be necessary but it's a quick way to 
see if thing are going where you expected) and reload your iptables rules.

>My apologies for the early morning stupidity.
>  
>

I've found another cup of coffee often relieves this condition  ;-)   
I'm not much of a script writer on a good day (after coffee) so I 
welcome any suggested corrections or improvements.

Jeff

[-- Attachment #2: Type: text/html, Size: 2357 bytes --]

      reply	other threads:[~2003-09-10 17:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-10 11:29 putting all logs in a file akshaysalkar
2003-09-10 12:45 ` Stephen Smoogen
2003-09-10 15:11   ` Jeffrey Laramie
2003-09-10 15:39     ` Stephen Smoogen
2003-09-10 17:53       ` Jeffrey Laramie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F5F650B.3080404@Loudoun-Fairfax.com \
    --to=jalaramie@loudoun-fairfax.com \
    --cc=akshaysalkar@indiatimes.com \
    --cc=netfilter@lists.netfilter.org \
    --cc=smoogen@lanl.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox