Results 1 to 4 of 4

Thread: Clearing logged info from iptables?

  1. #1
    Join Date
    Jul 2007
    Location
    Toronto, Ontario, Canada
    Beans
    265

    Clearing logged info from iptables?

    This is actually for my router, but it's linux based, so I'm hoping someone may be able to help.

    Anyway, I currently have a router running tomato linux firmware and at 30 minute intervals I have it send a log file of bandwidth usage to a network drive.

    From there, a program calculates the bandwidth used by each IP by adding up all the totals recorded in the log files.

    The log files are the output of the router running the command:

    Code:
    iptables -L traffic_in -vn
    What doesn't happen though, which I'd prefer, is that the bandwidth counts inside the router get cleared upon writing each log file. This way, I don't end up counting the same bandwidth use multiple times.

    So my question is, is there a way to erase/reset the data count in the iptables?

    Thanks,

    Dillon

  2. #2
    Join Date
    Mar 2010
    Beans
    21

    Re: Clearing logged info from iptables?

    From `man iptables`:

    -Z, --zero [chain]
    Zero the packet and byte counters in all chains. It is legal to
    specify the -L, --list (list) option as well, to see the coun-
    ters immediately before they are cleared. (See above.)

  3. #3
    Join Date
    Apr 2009
    Beans
    49

    Re: Clearing logged info from iptables?

    Try the '-Z' flag for iptables:

    Quote Originally Posted by man iptables
    -Z, --zero [chain]
    Zero the packet and byte counters in all chains. It is legal to specify the -L, --list (list) option as well, to see the counters immediately before they are cleared. (See above.)

  4. #4
    Join Date
    Jul 2007
    Location
    Toronto, Ontario, Canada
    Beans
    265

    Re: Clearing logged info from iptables?

    Awesome, exactly what I needed. Thanks!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •