1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Bandwidth Monitoring Change Log > 2 years?

Discussion in 'Tomato Firmware' started by Terror1, Oct 1, 2011.

  1. Terror1

    Terror1 Addicted to LI Member

    At the moment I am running a Asus RT-N16 and have been logging usage info for the last 2 years, at this point when a new month comes the oldest month gets deleted as far as I can tell. Is there a setting that I can change in telnet that will increase the amount of time to log usage for?
  2. fubdap

    fubdap Addicted to LI Member

    If you do not save your bandwidth data to an external drive it will reset whenever you reboot your router or you run out of ram. Since you have RT-N16, you can buy a usb thumb drive and save your data on it.
  3. Terror1

    Terror1 Addicted to LI Member

    I do and it is set to backup to the usb drive. I doubt that the thing is out of RAM since it has 32mb.

    The problem is that it will not display the logs for more than 2 years. It's like an internal cutoff. I would like to keep traffic logs indefinitely.

    [Now that I look all the data is stored on the USB by default. It doesn't commit to NVRAM or anyplace on the router internally.]
  4. fubdap

    fubdap Addicted to LI Member

    I also saved my bandwidth to a usb drive, but I do not have 2 years worth of data. Maybe it is a system limitation. We have a lot of smart folks here. They will find a way to unlock this.
  5. Terror1

    Terror1 Addicted to LI Member

    Well I sure hope so. I have been toying with it for the last few days and have looked at the rstats man pages and can't find a way to make it retain logs for any longer a period of time.
  6. Terror1

    Terror1 Addicted to LI Member

    Can I get a hand of where to start, I can't seem to find any config files for rstats. I am sure that there is a way, it's a matter of just finding out where to start looking.
  7. mraneri

    mraneri LI Guru Member

    I have been backing my BW data up for more than 2 years, and as the OP suggested, the router seems to discard the 25th month, so I always have only the last 2 years available...
  8. toolbox

    toolbox Addicted to LI Member

    I believe it is a compilation setting that determine number of months of BW data the rstats file will keep. There is nothing you can do to change it except to build your own firmware.
    A simple way to save more than 2 yr of BW data is do it manually. E.g save the plain text data every few months to a text file or an Excel file.
  9. teaman

    teaman LI Guru Member

    Please let me point out a few things in the source code for rstats (router/rstats/rstats.c) in Tomato v1.28 (http://repo.or.cz/w/tomato.git/blob...ad37133c4:/release/src/router/rstats/rstats.c):

    - line 60 defines MAX_NDAILY: the max number of samples being kept for daily traffic/history (62, about 2 months)
    - line 61 defines MAX_NMONTHLY: the max number of samples to be kept for monthly traffic/history (25, about 2 years)
    - lines 72~74: the version id/number of a datafile (identifies how to interpret the binary data in there)
    - lines 82~90 defines history_t: the 'current' data structure (please notice it's basically a static array, using the macros defined above)
    - lines 92~100 defines history_v0_t: the 'previous' version of the same data structure

    As we can see, the maximum number of samples (... or length of the 'historical data') gets defined at compilation time...
    It should be possible to 'extend' the amount of time (by increasing the number of samples, etc...), but since you wish to /keep/ the historical data gathered until now... you should also consider having a look at function load_history (line 281), then update/change the code responsible for loading and converting information stored on previous datafiles... (which might be tricky, considering we'd be taking about handling/extending static arrays, etc...).

    However, if you /do/ wish to work on this code and extend/update those features, please do share your updated/new code with the rest of us! :)
    If you choose to go down this path... please have a look at bwm-monthly.asp and admin-bwm.asp: on both these pages you might find links that could possibly help automating such task.

    Best of luck!
  10. toolbox

    toolbox Addicted to LI Member

    @Teaman, thank you for the pointers about what it takes to change the data storage for BW data. From OP's posts, I am not sure he even have the data from more than 2 yrs ago. Just backing up the file will not save more because the months over than 2 yr would have been over-written by new data.
    If someone does have rstats files that have data older than 2 year, there is a way to read it by a program someone wrote and it can be found at
    it may/can be part of the solution to have BW data longer than 2 yr.
  11. Terror1

    Terror1 Addicted to LI Member

    Thanks for the info, I will have to look into it, would anyone know of a good guide to get the development environment setup with the proper tool-chains and etc quickly?


Share This Page