LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 08-16-2023, 08:53 AM   #1
Jason.nix
Member
 
Registered: Feb 2023
Posts: 567

Rep: Reputation: 10
Post Where is iptables log?


Hello,
I don't know how can I see the firewall log? For example, I want to see the all input attempts.
The new version of Debian has not any /var/log/kern.log file. I guess that I must use the journalctl utility.
Please consider the following iptables rule:
Code:
iptables -A INPUT -j LOG --log-prefix='[netfilter]'
If any login attempts have occurred from any port, then the following command must show it:
Code:
# journalctl -k | grep netfilter
Am I right?


Thank you.
 
Old 08-16-2023, 04:20 PM   #2
GlennsPref
Senior Member
 
Registered: Apr 2004
Location: Brisbane, Australia
Distribution: Devuan
Posts: 3,660
Blog Entries: 33

Rep: Reputation: 283Reputation: 283Reputation: 283
This shows me kernel messages in syslog.
Code:
cat /var/log/syslog | grep kernel
I don't know much about "journalctl", I stopped using those systemd distros.

My recently updated Devuan 5.0 still has /var/log/kern.log

this might help...
https://tecadmin.net/enable-logging-...bles-on-linux/
 
Old 08-16-2023, 08:19 PM   #3
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,378
Blog Entries: 28

Rep: Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163Reputation: 6163
This article might help: https://www.putorius.net/how-to-log-...ssages-to.html
 
1 members found this post helpful.
Old 08-19-2023, 02:05 PM   #4
Jason.nix
Member
 
Registered: Feb 2023
Posts: 567

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by GlennsPref View Post
This shows me kernel messages in syslog.
Code:
cat /var/log/syslog | grep kernel
I don't know much about "journalctl", I stopped using those systemd distros.

My recently updated Devuan 5.0 still has /var/log/kern.log

this might help...
https://tecadmin.net/enable-logging-...bles-on-linux/
Hello,
Thank you so much.
Your articled used the Syslog
 
Old 08-19-2023, 02:08 PM   #5
Jason.nix
Member
 
Registered: Feb 2023
Posts: 567

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by frankbell View Post
Hello,
Thank you so much for your reply.
When my iptables rule is:
Code:
iptables -A INPUT -j LOG --log-prefix='[netfilter]'
Then, I must consider the square brackets in my filter:
Code:
# journalctl -k | grep [netfilter]
Am I right?
 
Old 08-20-2023, 11:16 AM   #6
jens
Senior Member
 
Registered: May 2004
Location: Belgium
Distribution: Debian, Slackware, Fedora
Posts: 1,465

Rep: Reputation: 299Reputation: 299Reputation: 299
Quote:
Originally Posted by Jason.nix View Post
Hello,
I don't know how can I see the firewall log? For example, I want to see the all input attempts.
The new version of Debian has not any /var/log/kern.log file. I guess that I must use the journalctl utility.
Please consider the following iptables rule:
Code:
iptables -A INPUT -j LOG --log-prefix='[netfilter]'
If any login attempts have occurred from any port, then the following command must show it:
Code:
# journalctl -k | grep netfilter
Am I right?


Thank you.
Their have been two changes when it comes iptables and logging (nftables and rsyslog/journald).

iptables was replaced by nftables starting with Debian 10 (Buster)
iptables is still available and you can switch back and forth between iptables-nft and iptables-legacy as explained here:
https://wiki.debian.org/iptables
Using nftables is encouraged: https://wiki.debian.org/nftables

Rsyslog has been deprecated since Debian 12 (Bookworm)
While you can still install and use rsyslog with journald, this isnt encouraged either.
https://wiki.debian.org/Rsyslog#Deprecation_in_Bookworm
 
2 members found this post helpful.
Old 08-21-2023, 05:38 AM   #7
Jason.nix
Member
 
Registered: Feb 2023
Posts: 567

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by jens View Post
Their have been two changes when it comes iptables and logging (nftables and rsyslog/journald).

iptables was replaced by nftables starting with Debian 10 (Buster)
iptables is still available and you can switch back and forth between iptables-nft and iptables-legacy as explained here:
https://wiki.debian.org/iptables
Using nftables is encouraged: https://wiki.debian.org/nftables

Rsyslog has been deprecated since Debian 12 (Bookworm)
While you can still install and use rsyslog with journald, this isnt encouraged either.
https://wiki.debian.org/Rsyslog#Deprecation_in_Bookworm
Hello,
Thank you so much for your reply.
So, in the new version of Debian, how you can see your iptables logs?
 
Old 08-21-2023, 05:53 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 22,022

Rep: Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343Reputation: 7343
probably here: https://tecadmin.net/enable-logging-...bles-on-linux/
But obviously, you need to have syslogd to use it.
 
  


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
How to log internal-sftp chroot jailed users access log to /var/log/sftp.log file LittleMaster Linux - Server 0 09-04-2018 03:45 PM
[SOLVED] iptables troubleshooting icmp and best place to log /var/log/messages or /var/log/iptables JockVSJock Linux - Security 18 02-12-2016 12:31 AM
Can Samhain log my entries in /var/log/secure and /var/log/mesage to a central server abefroman Linux - Software 2 04-13-2008 04:13 PM
Opennms Logs - where are web.log, web_rtc.log and webauth.log referenced? not_much_of_a_guru Linux - Networking 0 07-12-2006 10:28 AM
iptables v1.2.9: Unknown arg `/sbin/iptables' Try `iptables -h' or 'iptables --help' Niceman2005 Linux - Security 4 12-29-2005 08:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 05:25 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