Sarg - change output_dir



  • I'm running nanobsd on a 2GB CF with 4GB ram.  my squid logs are stored in ram (var/squid/logs) and I would like to store the sarg reports in ram as well.  I did this:

    mkdir /var/sarg-reports

    I then loaded the sarg.conf file via the web (diagnostics -> edit file) and changed the output_dir line to:

    output_dir = /var/sarg-reports

    I saved and ran sarg -x and new reports were generated to the new location (var/sarg-reports),  but at the top of the next hour, the new hourly report was saved to the old location.  I checked the config file and the "output_dir" had changed back to the old location.  how can I make it so sarg permanently saves reports to /var/sarg-reports?

    thanks.



  • @farmerjohn:

    how can I make it so sarg permanently saves reports to /var/sarg-reports?

    edit /usr/local/pkg/sarg.template file and save config again.



  • ok - that worked for saving to /var/sarg-reports.  but when I go to "view reports" sarg is still reading from the old location.  I deleted the old files:

    rm -rf /usr/local/sarg-reports/*

    and ran a force update, but am getting this from "view report"

    Error: Could not find report index file.
    Check and save sarg settings and try to force sarg schedule.

    the new reports and index.html are in the new location, but sarg is not looking there.  How can I point sarg to look to the new location?

    thanks.



  • @farmerjohn:

    The new reports and index.html are in the new location, but sarg is not looking there.  How can I point sarg to look to the new location?

    you can change sarg_frame.php and sarg.inc or create a symlink on /usr/local/



  • @marcelloc:

    you can change sarg_frame.php and sarg.inc or create a symlink on /usr/local/

    I made the change to sarg_frame.php before reading this post and everything is working ok.

    Since everything is working well, do I still need to make changes in sarg.inc?  if so, what line(s)?

    thanks.



  • @farmerjohn:

    Since everything is working well, do I still need to make changes in sarg.inc?  if so, what line(s)?

    It's up to you, the inc file has references to the /usr/local/sarg-reports



  • everything working well, but when I reboot, /var/sarg-reports is not being created.  I added /var/sarg-repports in sarg.inc:

    #check dirs
    $dirs=array("/var/sarg-reports","/usr/local/sarg-reports","/usr/local/www/sarg-images","/usr/local/www/sarg-images/temp");
    foreach ($dirs as $dir)
    if (!is_dir($dir))
    mkdir ($dir,0755,true);

    what should I do to create "/var/sarg-reports" on a reboot?

    thanks.



  • i added this line in /etc/rc.embedded:

    /bin/mkdir -p /var/sarg-reports

    /var/sarg-reports is now created on reboot.



  • Thanks for the feedback, I'll include this forder check before boot check to avoid this errors on embedded systems.


Log in to reply