( ! ) Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/lib/menu/GKBase.class.php on line 114
Call Stack
#TimeMemoryFunctionLocation
10.0010413776{main}( ).../index.php:0
20.11104264336Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.649915943488Joomla\CMS\Application\SiteApplication->render( ).../CMSApplication.php:202
40.650115943544Joomla\CMS\Application\SiteApplication->render( ).../SiteApplication.php:778
50.650215943920Joomla\CMS\Document\HtmlDocument->parse( ).../CMSApplication.php:1030
60.650215943920Joomla\CMS\Document\HtmlDocument->_fetchTemplate( ).../HtmlDocument.php:545
70.650415944016Joomla\CMS\Document\HtmlDocument->_loadTemplate( ).../HtmlDocument.php:730
80.650715982256require( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/component.php' ).../HtmlDocument.php:668
90.654616274200GKTemplate->__construct( ).../component.php:31
100.675116428080GKTemplateMenu->getMenuType( ).../gk.framework.php:84
110.675916472048require_once( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/lib/menu/GKMenu.php' ).../helper.menu.php:19

( ! ) Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/lib/menu/GKHandheld.php on line 76
Call Stack
#TimeMemoryFunctionLocation
10.0010413776{main}( ).../index.php:0
20.11104264336Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.649915943488Joomla\CMS\Application\SiteApplication->render( ).../CMSApplication.php:202
40.650115943544Joomla\CMS\Application\SiteApplication->render( ).../SiteApplication.php:778
50.650215943920Joomla\CMS\Document\HtmlDocument->parse( ).../CMSApplication.php:1030
60.650215943920Joomla\CMS\Document\HtmlDocument->_fetchTemplate( ).../HtmlDocument.php:545
70.650415944016Joomla\CMS\Document\HtmlDocument->_loadTemplate( ).../HtmlDocument.php:730
80.650715982256require( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/component.php' ).../HtmlDocument.php:668
90.654616274200GKTemplate->__construct( ).../component.php:31
100.677616595296GKTemplateMenu->getMenuType( ).../gk.framework.php:85
Force iptables to log messages to a different log file
Logo
Print this page

Force iptables to log messages to a different log file

Force iptables to log messages to a different log file

  1.  on OCTOBER 3, 2006 · 38 COMMENTS· LAST UPDATED FEBRUARY 23, 2008

According to man page:
Iptables is used to set up, maintain, and inspect the tables of IP packet filter rules in the Linux kernel. Several different tables may be defined. Each table contains a number of built-in chains and may also contain user defined chains.

By default, Iptables log message to a /var/log/messages file. However you can change this location. I will show you how to create a new logfile called /var/log/iptables.log. Changing or using a new file allows you to create better statistics and/or allows you to analyze the attacks.

Iptables default log file

For example, if you type the following command, it will display current iptables log from /var/log/messages file:
# tail -f /var/log/messages
Output:

Oct  4 00:44:28 debian gconfd (vivek-4435): Resolved address "xml:readonly:/etc/gconf/gconf.xml.defaults" to a read-only configuration source at position 2
Oct  4 01:14:19 debian kernel: IN=ra0 OUT= MAC=00:17:9a:0a:f6:44:00:08:5c:00:00:01:08:00 SRC=200.142.84.36 DST=192.168.1.2 LEN=60 TOS=0x00 PREC=0x00 TTL=51 ID=18374 DF PROTO=TCP SPT=46040 DPT=22 WINDOW=5840 RES=0x00 SYN URGP=0
Oct  4 00:13:55 debian kernel: IN=ra0 OUT= MAC=ff:ff:ff:ff:ff:ff:00:18:de:55:0a:56:08:00 SRC=192.168.1.30 DST=192.168.1.255LEN=78 TOS=0x00 PREC=0x00 TTL=128 ID=13461 PROTO=UDP SPT=137 DPT=137 LEN=58

Procedure to log the iptables messages to a different log file

Open your /etc/syslog.conf file:
# vi /etc/syslog.conf
Append following line
kern.warning /var/log/iptables.log
Save and close the file.

Restart the syslogd (Debian / Ubuntu Linux):# /etc/init.d/sysklogd restartOn the other hand, use following command to restart syslogd under Red Hat/Cent OS/Fedora Core Linux:# /etc/init.d/syslog restart

Now make sure you pass the log-level 4 option with log-prefix to iptables. For example:
# DROP everything and Log it
iptables -A INPUT -j LOG --log-level 4
iptables -A INPUT -j DROP

For example, drop and log all connections from IP address 64.55.11.2 to your /var/log/iptables.log file:
iptables -A INPUT -s 64.55.11.2 -m limit --limit 5/m --limit-burst 7 -j LOG --log-prefix '** HACKERS **'--log-level 4
iptables -A INPUT -s 64.55.11.2 -j DROP

Where,

  • --log-level 4: Level of logging. The level # 4 is for warning.
  • --log-prefix '*** TEXT ***': Prefix log messages with the specified prefix (TEXT); up to 29 letters long, and useful for distinguishing messages in the logs.

You can now see all iptables message logged to /var/log/iptables.log file:
# tail -f /var/log/iptables.log

Updated for accuracy.


( ! ) Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 169
Call Stack
#TimeMemoryFunctionLocation
10.0010413776{main}( ).../index.php:0
20.11104264336Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.11104264336Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.520011455320Joomla\CMS\Application\SiteApplication->dispatch( ).../SiteApplication.php:233
50.521011479696Joomla\CMS\Component\ComponentHelper::renderComponent( ).../SiteApplication.php:194
60.522211535024Joomla\CMS\Component\ComponentHelper::executeComponent( ).../ComponentHelper.php:377
70.522511562424require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:402
80.533211962056K2ControllerItem->execute( ).../k2.php:64
90.533211962056K2ControllerItem->display( ).../BaseController.php:710
100.546812612760K2ControllerItem->display( ).../item.php:78
110.546812612760K2ControllerItem->display( ).../controller.php:19
120.552912983800Joomla\CMS\Cache\Controller\ViewController->get( ).../BaseController.php:663
130.555813004168K2ViewItem->display( ).../ViewController.php:102
140.643015864928K2ViewItem->display( ).../view.html.php:742
150.643015864928K2ViewItem->loadTemplate( ).../HtmlView.php:230
160.645416037864include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ).../HtmlView.php:701

( ! ) Notice: Only variables should be assigned by reference in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 478
Call Stack
#TimeMemoryFunctionLocation
10.0010413776{main}( ).../index.php:0
20.11104264336Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.11104264336Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.520011455320Joomla\CMS\Application\SiteApplication->dispatch( ).../SiteApplication.php:233
50.521011479696Joomla\CMS\Component\ComponentHelper::renderComponent( ).../SiteApplication.php:194
60.522211535024Joomla\CMS\Component\ComponentHelper::executeComponent( ).../ComponentHelper.php:377
70.522511562424require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:402
80.533211962056K2ControllerItem->execute( ).../k2.php:64
90.533211962056K2ControllerItem->display( ).../BaseController.php:710
100.546812612760K2ControllerItem->display( ).../item.php:78
110.546812612760K2ControllerItem->display( ).../controller.php:19
120.552912983800Joomla\CMS\Cache\Controller\ViewController->get( ).../BaseController.php:663
130.555813004168K2ViewItem->display( ).../ViewController.php:102
140.643015864928K2ViewItem->display( ).../view.html.php:742
150.643015864928K2ViewItem->loadTemplate( ).../HtmlView.php:230
160.645416037864include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ).../HtmlView.php:701
Template Design © Joomla Templates | GavickPro. All rights reserved.