LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-27-2023, 02:46 PM   #1
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,971

Rep: Reputation: 271Reputation: 271Reputation: 271
13,661,802 instances of ...LOG_INPUT: IN=eth0 OUT= MAC=...


syslog has 13,661,802 instances of
Quote:
...LOG_INPUT: IN=eth0 OUT= MAC=...
What do they come from?
 
Old 06-27-2023, 05:06 PM   #2
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,971

Original Poster
Rep: Reputation: 271Reputation: 271Reputation: 271
I figured out that they come from iptables. I changed rsyslog.conf to log their entries to separate files but they still show up in messages.
 
Old 06-27-2023, 06:27 PM   #3
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,733

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
I think you have to set up log files in iptables itself. messages is the default. I’ve not figured that out yet…I’m using firewalld.
Not high on my list to fix…there’s little else in messages.
 
Old 06-27-2023, 07:32 PM   #4
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196
You can set the log level in any rule which invokes the LOG target. From man iptables-extensions:

Code:
   LOG
    Turn on kernel logging of matching packets.  When this option is set for a rule, the Linux  kernel
    will print some information on all matching packets (like most IP/IPv6 header fields) via the ker‐
    nel log (where it can be read with dmesg(1) or read in the syslog).

    This is a "non-terminating target", i.e. rule traversal continues at the next  rule.   So  if  you
    want  to LOG the packets you refuse, use two separate rules with the same matching criteria, first
    using target LOG then DROP (or REJECT).

    --log-level level
           Level of logging, which can be (system-specific) numeric or a  mnemonic.   Possible  values
           are  (in decreasing order of priority): emerg, alert, crit, error, warning, notice, info or
           debug.

    --log-prefix prefix
           Prefix log messages with the specified prefix; up to 29 letters long, and useful  for  dis‐
           tinguishing messages in the logs.
In your example log line, '...LOG_INPUT' is probably the --log-prefix value. You can identify the origin rule by grepping for this value (see below).

Whether or not a given line is actually added to a log, and which one, is determined by the configuration of syslog on your system. As I understand it, the log level of the message as set in an iptables rule, is masked by the syslog selector to determine what actually enters the log. See man syslog.conf, SELECTORS for more details.

But it appears that you do not know what rules are sending the log messages, or why, so it would probably be informative try to find their source and determine whether you are even interested in logging them.

You might try grepping the existing rules for LOG as a starting point.

Code:
iptables -S |grep -i LOG
If your rules are using the NFLOG target instead of LOG, you will see that in the rules along with --nflog-prefix, etc., but the above still applies.

That will tell you what rules are logging and what chain they are located in. You should be able to match that with your firewall config or application to turn logging on or off, or change the log level.

Hope that helps!

Last edited by astrogeek; 06-27-2023 at 07:43 PM.
 
1 members found this post helpful.
Old 06-28-2023, 09:07 AM   #5
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,971

Original Poster
Rep: Reputation: 271Reputation: 271Reputation: 271
Quote:
Originally Posted by scasey View Post
I think you have to set up log files in iptables itself. messages is the default.
Yes. Each line that wants logging uses -j LOG , --log-level sets the level

Quote:
Originally Posted by astrogeek View Post
You can set the log level in any rule which invokes the LOG target. From man iptables-extensions:...
It's in man iptables on this system. Unfortunately --log-level rejects LOCAL? arguments and rsyslog.conf doesn't honor my setting of programname=iptables to separate these entries.

log-level takes numbers. man syslog.conf, which I use on my machine, lists numbers for each level. man rsyslog.conf, though it accepts LOCAL?, doesn't list numbers.
 
Old 06-28-2023, 12:12 PM   #6
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 786

Rep: Reputation: 250Reputation: 250Reputation: 250
You should set a seperate file for firewall messages. This is the (snippet) rsyslog.conf I use:

Code:
# Log anything (except mail, spooler) of level info or higher.
# Don't log private authentication messages!
*.info;mail.none;authpriv.none;auth.none;cron.none;\
uucp.none;news.none;lpr.none				/var/log/syslog

# The authpriv file has restricted access.
authpriv.*;auth.*					/var/log/secure

# Log all the mail messages in one place.
mail.*                                                  /var/log/maillog

# Log cron stuff
cron.*                                                  /var/log/cron

# Everybody gets emergency messages
*.emerg                                                 :omusrmsg:*

# Save news, uucp, and lpr (printing) messages to spooler file
uucp,news,lpr.*                                         /var/log/spooler

# Save (usually unused) local* to main syslog
local0,local1,local2,local3,local4,local5,local6,local7.* /var/log/syslog

# Firewall (really log lev7), of the kernel (only)
kern.=debug						/var/log/firewall

# Verbose output from daemons.
daemon.=debug						/var/log/debug
There's no "messages". They are all messages.

Consider rate limiting your iptables log target messages so they don't flood the logs and make them unusable.
Code:
iptables -A INPUT -m set --match-set blocklist src -m limit -j LOG --log-level 7 --log-prefix "Ipset blocklist: "
iptables -A INPUT -m set --match-set blocklist src -j DROP
Note the "-m limit". It's configurable.
 
Old 06-29-2023, 12:21 AM   #7
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,971

Original Poster
Rep: Reputation: 271Reputation: 271Reputation: 271
Quote:
Originally Posted by jayjwa View Post
You should set a seperate file for firewall messages. This is the (snippet) rsyslog.conf I use...
How do you know iptables log-levels correspond to which rsyslog facilities?
Quoth man syslog.conf
Quote:

Code Facility Description
0 kern Kernel log messages
1 user User-level messages
2 mail Mail system
3 daemon General system daemons
4 auth Security/authorization messages
5 syslog Messages generated by syslogd
6 lpr Line printer subsystem
7 news Network news subsystem
8 uucp UNIX-to-UNIX copy
9 cron Clock/cron daemon (BSD, Linux)
10 authpriv Security/authorization messages (private)
11 ftp FTP daemon
12 ntp NTP subsystem
13 security Log audit
14 console Log alert
15 unused Clock/cron daemon (Solaris)
16 local0 Reserved for local/system use
17 local1 Reserved for local/system use
18 local2 Reserved for local/system use
19 local3 Reserved for local/system use
20 local4 Reserved for local/system use
21 local5 Reserved for local/system use
22 local6 Reserved for local/system use
23 local7 Reserved for local/system use
man rsyslog has no such list. When I tried to set log-level to 16 iptables objected. When I set it to 3 rsyslog didn't put its messages where I configured rsyslog.conf to send daemon's.
 
Old 06-29-2023, 09:20 PM   #8
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 786

Rep: Reputation: 250Reputation: 250Reputation: 250
Quote:
Originally Posted by RandomTroll View Post
How do you know
They probably follow /usr/include/sys/syslog.h, whether rsyslog or inetutils syslog. Sometimes I run rsyslogd, sometimes syslogd, but the messages end up in the right place no matter which is running.
 
Old 06-30-2023, 05:16 AM   #9
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,971

Original Poster
Rep: Reputation: 271Reputation: 271Reputation: 271
Quote:
Originally Posted by jayjwa View Post
They probably follow /usr/include/sys/syslog.h...
It's a difference in terminology. When iptables uses log-level they refer to priority; I was referring to facility. Some other source I deal with uses level when it means facility, which confused me. I'd really like iptables to let me specify a facility so I could put all its messages in a unique log but I can't find that in the man pages.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Gigabyte GA-H55M-UD2H LGA 1156 Intel Core i5-661 Rambler999 Linux - Newbie 2 02-19-2023 06:07 AM
acpi-cpufreq and I5 661 CPU alexiy Slackware 6 03-28-2010 04:27 AM
onboard sis 661 fx angle2009 Linux - Hardware 7 07-08-2007 08:51 PM
RedHat 8.0 with 802.11a 802.11b and 802.11g Bryanx Linux - Hardware 2 05-23-2003 02:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:43 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration