LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-15-2013, 02:12 AM   #1
tindecken
LQ Newbie
 
Registered: Nov 2013
Posts: 5

Rep: Reputation: Disabled
[Help] How to generate a log when stop iptables (centos)


Hi all,
I'm a tester and I have a problem need your help.
Anyone known how to generate a log when I stop iptables?

I'll use command: service iptables stop
Note: not use command "service iptabels status"

How to I configure my centos system to do that?
Thank all for your support?
 
Old 11-15-2013, 02:32 AM   #2
manikandanc
LQ Newbie
 
Registered: Jul 2013
Posts: 15

Rep: Reputation: Disabled
As you are a tester, I assume that you are doing this in your test machine and not on a production/customer machine. and I assume that you have root privileges for that machine. If that is the case, is it possible for you to modify the /etc/init.d/iptables (stop method) to log whatever you want? Have to read more about making iptables to generate logs while stopping.

Quote:
Originally Posted by tindecken View Post
Hi all,
I'm a tester and I have a problem need your help.
Anyone known how to generate a log when I stop iptables?

I'll use command: service iptables stop
Note: not use command "service iptabels status"

How to I configure my centos system to do that?
Thank all for your support?
 
Old 11-15-2013, 02:48 AM   #3
tindecken
LQ Newbie
 
Registered: Nov 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
Hi manikandanc,
Thank for your posting.
I have root privileges on my system.
Mean you suggest me to modify script /etc/init.d/iptables look like imgae below?
https://docs.google.com/file/d/0B0jL...STQ/edit?pli=1
 
Old 11-15-2013, 03:04 AM   #4
manikandanc
LQ Newbie
 
Registered: Jul 2013
Posts: 15

Rep: Reputation: Disabled
Quote:
Originally Posted by tindecken View Post
Hi manikandanc,
Thank for your posting.
I have root privileges on my system.
Mean you suggest me to modify script /etc/init.d/iptables look like imgae below?
https://docs.google.com/file/d/0B0jL...STQ/edit?pli=1
Yes.. Also, I think it would be a good idea if you can include the date. Might help you in lots of times

if [ $RETVAL -ne 0 ] ; then
echo `date` "IPTables stopped" >> /var/log/iptables
fi
 
Old 11-15-2013, 03:15 AM   #5
tindecken
LQ Newbie
 
Registered: Nov 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
yeah, it's very helpfull. I have spent 1 day on Google searching for this problem. o.O
Thank you very much.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] How do you get cdrdao to generate a log file? Holering Linux - Software 2 05-24-2013 05:22 AM
Perl that generate log file casualzone Programming 1 12-21-2011 08:58 AM
Generate audit log every 6 months it_guy Red Hat 2 03-11-2011 07:18 AM
Not able to generate boot.log. pinga123 Linux - Newbie 11 02-21-2011 02:16 AM
How to generate a log in syslog PlatinumX Linux - Newbie 3 09-07-2010 01:12 PM


All times are GMT -5. The time now is 04:18 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration