Revision [938]
This is an old revision of BandwidthD made by Pluk77 on 2009-08-03 05:22:24.
DATA LOGGING
Bandwidthd can be made to log to CDF by setting "output_cdf" to true. This will now log out each interval's traffic, so you can import them into a database and use a tool like access to create your own graphs, or implement 95 percentile billing, for example.These logs are
- log.1.0.cdf - log.1.5.cdf for daily
- log.2.0.cdf - log.2.5.cdf for weekly
- log.3.0.cdf - log.3.5.cdf for montlhy
- log.4.0.cdf - log.4.5.cdf for yearly
The log format is best documented in the "StoreIPDataInCDF" function in bandwidthd.c. As of this writing, it consists of one line for each IP address for each interval.
The line contains only data for the previous interval.
Fields:
IP Address,Timestamp,Total Sent,Icmp Sent,Udp Sent,Tcp Sent,Ftp Sent,Http Sent, P2P Sent,Total Received,Icmp Received,Udp Received,Tcp Received,Ftp Received,Http Received, P2P Received
ACTIVATE LOG ROTATE
Sending Bandwidthd a HUP will cause it to rotate it's logs.It will rotate out 5 times before deleting the oldest log file.
You will also want to make a crontab entry like so:
0 0 * * * root /bin/kill -HUP `cat /var/run/bandwidthd.pid`
This will send Bandwidthd a HUP every night at midnight. When Bandwidthd receives a HUP it schedules a rotation of it's log files during the next graphing run. Daily log files rotate each HUP.
Weekly/Monthly/Yearly log files rotate every so many HUPs.
CONVERT UNIX TIMESTAMP TO DATE/TIME
You can import the raw CDF files into Open Office calc and use the following function to convert the timestamp to a normal date/time:
=(B2/86400)+(DATEVALUE("70/01/01"))