warning level:

iptables -A INPUT -j LOG --log-prefix "BAD_INPUT: " --log-level 4
iptables -A FORWARD -j LOG --log-prefix "BAD_FORWARD: " --log-level 4
iptables -A OUTPUT -j LOG --log-prefix "BAD_OUTPUT: " --log-level 4

commonly used examples

ip6tables -t raw -I PREROUTING -j LOG --log-prefix "prerouting-raw: " --log-level 4
ip6tables -t nat -I PREROUTING -j LOG --log-prefix "prerouting-nat: " --log-level 4 ip6tables -t mangle -I INPUT -j LOG --log-prefix "input-mangle: " --log-level 4
ip6tables -t filter -I INPUT -j LOG --log-prefix "input-filter: " --log-level 4 ip6tables -t mangle -I FORWARD -j LOG --log-prefix "forward-mangle: " --log-level 4 ip6tables -t filter -I OUTPUT -j LOG --log-prefix "output-filter: " --log-level 4 ip6tables -t nat -I POSTROUTING -j LOG --log-prefix "postrouting-nat: " --log-level 4
ip6tables -t mangle -I POSTROUTING -j LOG --log-prefix "postrouting-mangle: " --log-level 4
ip6tables -t mangle -A POSTROUTING -j LOG --log-prefix "postrouting-mangle-end: " --log-level 4

CentOS 7 uses systemd's journald as the default logs system, and with this the kernel logs (like the ones from iptables) are not directed to /var/log/messages but to journald and should be displayed by passing the -k (meaning kernel logs) to journalctl like this:

journalctl -k

日志如果太多, 可以清空再跑 (不太靠谱,经常搞死journal)

rm /run/log/journal/* -rf;systemctl restart systemd-journald

还是用这个参数:

-S --since=DATE          Show entries not older than the specified date

Ref:

https://unix.stackexchange.com/questions/423778/log-iptables-events-on-centos-7

 

how to log iptables events的更多相关文章

  1. iptables log

    iptables 日志 LOG target 这个功能是通过内核的日志工具完成的(rsyslogd) LOG现有5个选项 --log-level debug,info,notice,warning,w ...

  2. iptables log日志记录功能扩展应用:iptables自动配置临时访问策略,任意公网登录服务器

    一.修改日志记录: 1. 修改配置文件: vi /etc/rsyslog.conf 添加以下内容 #iptables log kern.=notice /var/log/iptables.log 2. ...

  3. Change the IPTables log file

    http://www.networkinghowtos.com/howto/change-the-iptables-log-file/     An important aspect of any f ...

  4. iptables日志探秘

    iptables日志探秘 防火墙的主要功能除了其本身能进行有效控制网络访问之外,还有一个很重要的功能就是能清晰地记录网络上的访问,并自动生成日志进行保存.虽然日志格式会因防火墙厂商的不同而形态各异,但 ...

  5. Ubuntu iptables配置

    sudo su sudo apt-get install iptables-persistent modprobe ip_tables #启动iptable   #删除原有iptables规则 ipt ...

  6. iptables rule

    和H3C中的acl很像,或者就是一会事,这就是不知道底层的缺陷,形式一变,所有的积累都浮云了 参考准确的说copy from http://www.ibm.com/developerworks/cn/ ...

  7. linux服务之iptables与firewalld

    开发语言: 服务器端:在内核中实现,无守护程序 客户端:一般是cli界面下的iptables命令 相关包:iptables-1.4.7-11.el6.x86_64 netfilter/iptables ...

  8. CentOS学习笔记--防火墙iptables

    Linux 的防火墙:iptables iptables是封包过滤软件,Linux内核2.6以上都是这款软件.本节节选自 鸟哥的 Linux 私房菜 -- 服务器架设篇  第九章.防火墙与 NAT 服 ...

  9. Iptables DDOS/CC 自动屏蔽脚本

    Iptables DDOS/CC 自动屏蔽脚本 May 20, 2013 最近不停地被 CC (DDOS的一种)频繁干扰,分享一个 iptables 屏蔽 DDOS 的脚本.让 crond 每分钟运行 ...

  10. 7.5 Point-in-Time (Incremental) Recovery Using the Binary Log 使用binay log 基于时间点恢复

    7.5 Point-in-Time (Incremental) Recovery Using the Binary Log 使用binay log 基于时间点恢复 7.5.1 Point-in-Tim ...

随机推荐

  1. 使用Stream流实现以List<Map<String, Object>>集合中Map的key值进行排序

    使用Stream流实现以List<Map<String, Object>>集合中Map的key值进行排序 创建一个list存入数据 List<Map<String, ...

  2. 《探索Python Requests中的代理应用与实践》

    requests加代理 高匿API代理 此处使用的小象代理:1元100个,便宜,可以购买尝试加下代理 存活期1到2分钟 import time import requests from lxml im ...

  3. 使用win server 2019服务器的iis服务发布静态网页

    1.首先远程连接到服务器 2.打开服务器管理器 3添加角色和功能 4.安装类型:选择基于角色或基于功能的安装  →服务器角色:从服务器池中选择服务器 5.服务器角色选择Web服务器(iis) 6.功能 ...

  4. 数据类型的别名&&随机数_C

    // Code file created by C Code Develop #include "ccd.h" #include "stdio.h" #incl ...

  5. .NET周刊【7月第3期 2024-07-21】

    国内文章 给博客园的寄语 https://www.cnblogs.com/jingc/p/18307859 作者是一名39岁的大龄C#开发程序员,对博客园的艰难处境深感触动,并购买会员支持.回顾他与博 ...

  6. 关于RuntimeException与事务

    1.spring的默认回滚策略 当采用@Transactional注解方法抛出RuntimeException时,spring会默认回滚事务 对于检查型异常(即不是RuntimeException子类 ...

  7. chromedriver.exe存放位置

    chromedriver.exe存放位置 如果chromedriver.exe存放位置不对的话,driver=webdriver.Chrome() 会报错! 一般需要存放在python下面的Scrip ...

  8. 如何自动实现本地AD中禁用的用户从地址列表中隐藏掉?

    我的博客园:https://www.cnblogs.com/CQman/ 如何自动实现本地AD中禁用的用户从地址列表中隐藏掉? 需求信息: 用户本地AD用户通过ADConnect同步到O365,用户想 ...

  9. Intel因特尔10700k CPU的核显驱动

    下载地址: https://www.intel.cn/content/www/cn/zh/download/776137/intel-7th-10th-gen-processor-graphics-w ...

  10. docker容器下安装nccl失败,报错:Failed to init nccl communicator for group,init nccl communicator for group nccl_world_group

    相关内容参考: https://www.cnblogs.com/devilmaycry812839668/p/15022320.html =============================== ...