Skip to content

guhaitao/ipl2sql

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

ipl2sql

iptables log to SQL converter.

This utility converts iptables log to a series of SQL queries(MySQL-compatible) and outputs them to stdout(just like mysqldump).

Table structure

CREATE TABLE `packets` (
  `IN` varchar(6) DEFAULT NULL,
  `OUT` varchar(6) DEFAULT NULL,
  `SRC` varchar(15) DEFAULT NULL,
  `DST` varchar(15) DEFAULT NULL,
  `LEN` int(11) DEFAULT NULL,
  `SPT` int(11) DEFAULT NULL,
  `DPT` int(11) DEFAULT NULL,
  KEY `IN` (`IN`,`OUT`,`SRC`,`DST`),
  KEY `SPT` (`SPT`,`DPT`)
)

Basic usage

Syntax:

python ipl2sql <logfile> <table_name>

...where logfile is a iptables log file(see demo.log), and table_name is a name of table which will be used in DELETE and INSERT statements.

python ipl2sql iptables.log packets > packets.sql
mysql iptables < packets.sql

.. or a simpler way:

python ipl2sql iptables.log packets | mysql iptables

About

iptables log to SQL converter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published