Traffic Logging into the Database

This allows recording the traffic counters into the database and building a fast and scalable traffic accounting system for your users. To use this feature you should specify:

What is the Traffic Samples parameter?

This sets a time interval for a single Traffic Sample. The Traffic Sample is an amount of bytes captured by the specific filter for the time interval started at the specific time.

How does TrafMeter write the counters into the database?

  1. A current value of the "ts" field is derived: 1) from a user-defined Traffic Samples parameter 2) from the current local time. For example, if the current time is 19:49 on August 22, 2003, then
    User-defined Traffic Samples Value of ts (in the ymmddhhmi format)
    1 minute 308221949
    5 minutes 308221945
    15 minutes 308221945
    30 minutes 308221930
    1 hours 308221900
    2 hours 308221800
    1 day 308220000

  2. The command "SELECT * FROM traffic_table WHERE ts=308222145" is issued and the database counters stored in the table are retrieved into a temporary counters storage.
  3. The counters, unsaved since the last database update are added to the counters stored in the temporary storage.
  4. The temporary counter storage is flushed into the database.