Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an iptables firewall in Linux bridge (RHEL5). I want to extract information like IP address, port number, port type, date and time, etc. from log messages using a Bash script, and then want to upload it to a MySQL database to generate the reports.

How can I do this? Is there any way to accomplish the same thing?

share|improve this question
I suspect you'll get a better response from Stack Overflow. – Tshepang Dec 8 '10 at 11:28

If you're using syslog-ng, there is a great guide here. He sets up a queue: syslog-ng writes to it, and he has a consumer that reads from it and performs an SQL insert.

If you are using rsyslogd, it has native support for mysql, but I'd still recommend the message-passing method of the first article; especially if you have high traffic spikes since the database insert takes a substantial amount of time (comparatively).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.