Custom reports in BandwidthD? Or how do I download the log.cdf file?



  • I've got BandwidthD up and running on my pfSense 1.2.1-rc1 system.  Is there any way to create custom reports (i.e. weekly), or am I limited to the daily/monthly/yearly reports that come with it?

    I also have it set to save data to the htdocs/log.cdf file, but how can I actually download that file to use it?

    Thanks for any input…

    JB



  • The *.cdf files are actually up a level from the htdocs folder (in /usr/local/bandwidthd/) you can SCP in if SSH is enabled. http://doc.pfsense.org/index.php/HOWTO:_Access_pfSense_filesystems_remotely_with_scp



  • Does anyone know how to analyse the cdf spreadsheet to create reports for custom date ranges?



  • Sheesh.. I have now been searching high and low to find an answer to this question. Some previous user has posted a similar query to mine but there was no finite answer. I can understand why.. I suppose; running a database on your firewall isn't such a good idea…. Here is the post link: http://forum.pfsense.org/index.php?topic=3234.0

    My question. BandwidhtD generates its log files and then save them in /usr/local/bandwidhtd log.1.0.cdf etc. I want to parse these files using a PHP script and then post the field values to a MySQL database running on some other server. After some research, I have managed to get MySQL working by installing the MySQL client package and the mysql.so extension. (It may be a good idea to make this part of future releases...?)

    The issue, as correctly pointed out by the other user, PFsense or something restores the default php.ini file. Not nice :(. I can appreciate this for stability reasons. I have a work around to load the mysql.so extension, but there must be a better way. Here is how I am currently doing it:

    dl('mysql.so'); //Loading the mysql database extension
    $FSQLHost = "192.168.1.105"; //IP address of other Server
    $FSQLUser = "root";
    $FSQLPass = "somepass";
    $FSQLDB = "bandwidthd";

    $FSQLLink = mysql_connect($FSQLHost, $FSQLUser, $FSQLPass) ; //Connection to the database running on 192.168.1.105:3306
    mysql_select_db($FSQLDB, $FSQLLink);

    $mqry = "show databases";
    $fdata = mysql_query($mqry, $FSQLLink);

    while ($fline = mysql_fetch_assoc($fdata)) {
      print_r($fline);
    }

    ?>

    Questions:
    1. How can I load the extension on start-up like one normally would using the php.ini
    2. Am I re-inventing the wheel here. I know about the postgres solution, but I need this to work on PHP for very custom reports. Would be nice if there was a out-of-the box tool for custom reporting and data mining.

    Any help will be greatly appreciated.



  • @rhy7s:

    Does anyone know how to analyse the cdf spreadsheet to create reports for custom date ranges?

    Still would like to know how to go about this if anyone has a method to use, there's the link on the wiki http://devwiki.pfsense.org/BandwidthD but I get a message about too many rows when opening my yearly log. I'd really like to get a custom report per IP for custom date ranges but not sure how to achieve this.


Log in to reply