| 1 | = Log rotation = |
| 2 | |
| 3 | The log files generated by BOINC's daemons and servers can grow to gigabyte size in a few days or weeks, and will eventually fill up your disk. When this happens your project will grind to a halt. In addition, if you use db_dump to export statistics, directories with names of the form '''html/stats_2006_4_3_15_50_2''' will build up, and you'll need to delete and possibly archive them. Most projects do this manually. |
| 4 | |
| 5 | Initially you can deal with log files by hand, but eventually you may want an automated solution. Log rotation typically must be done while the project is [http://boinc.berkeley.edu/tool_start.php stopped]. |
| 6 | |
| 7 | (Note: Eric Myers wrote a detailed page about log rotation, which is [http://www.spy-hill.net/~myers/help/boinc/log_rotation.html here]). |
| 8 | |
| 9 | Here's a shell script (from Nicolas Alvarez) that tars and compresses log files (you'll still need to eventually deal with the compressed files). You can run this script as a periodic task in [http://boinc.berkeley.edu/configuration.php config.xml]. |
| 10 | |
| 11 | |
| 12 | {{{ |
| 13 | #!/bin/bash |
| 14 | cd .. |
| 15 | ./bin/stop |
| 16 | pushd ./log_servername |
| 17 | BACKUP_DIR=`date --utc +backup_%Y_%m_%d` |
| 18 | mkdir $BACKUP_DIR |
| 19 | mv *.log *.out $BACKUP_DIR |
| 20 | pushd .. |
| 21 | ./bin/start& |
| 22 | popd |
| 23 | tar cjvf $BACKUP_DIR.tar.bz2 $BACKUP_DIR |
| 24 | rm -rf $BACKUP_DIR |
| 25 | popd |
| 26 | }}} |
| 27 | Other projects the Linux 'logrotate' program. For example, Predictor@home uses the following logrotate input file (they run this while the project is down for database backups): |
| 28 | |
| 29 | |
| 30 | {{{ |
| 31 | /export/projects/predictor/log_predictor1/cgi.log{ |
| 32 | compress |
| 33 | dateext |
| 34 | maxage 365 |
| 35 | rotate 99 |
| 36 | size=+1096k |
| 37 | notifempty |
| 38 | missingok |
| 39 | create 664 wwwrun users |
| 40 | postrotate |
| 41 | /etc/init.d/apache2 reload |
| 42 | endscript |
| 43 | } |
| 44 | |
| 45 | /export/projects/predictor/log_predictor1/file_upload_handler.log{ |
| 46 | compress |
| 47 | dateext |
| 48 | maxage 365 |
| 49 | rotate 99 |
| 50 | size=+1096k |
| 51 | notifempty |
| 52 | missingok |
| 53 | create 664 wwwrun users |
| 54 | postrotate |
| 55 | /etc/init.d/apache2 reload |
| 56 | endscript |
| 57 | } |
| 58 | |
| 59 | /export/projects/predictor/log_predictor1/transitioner.log{ |
| 60 | compress |
| 61 | dateext |
| 62 | maxage 365 |
| 63 | rotate 99 |
| 64 | size=+1096k |
| 65 | notifempty |
| 66 | missingok |
| 67 | create 644 boinc users |
| 68 | } |
| 69 | |
| 70 | /export/projects/predictor/log_predictor1/taskmaster.log{ |
| 71 | compress |
| 72 | dateext |
| 73 | maxage 365 |
| 74 | rotate 99 |
| 75 | size=+1096k |
| 76 | notifempty |
| 77 | missingok |
| 78 | create 644 boinc users |
| 79 | } |
| 80 | |
| 81 | /export/projects/predictor/log_predictor1/assimilator_placeholder.log{ |
| 82 | compress |
| 83 | dateext |
| 84 | maxage 365 |
| 85 | rotate 99 |
| 86 | size=+1096k |
| 87 | notifempty |
| 88 | missingok |
| 89 | create 644 boinc users |
| 90 | } |
| 91 | |
| 92 | /export/projects/predictor/log_predictor1/feeder.log{ |
| 93 | compress |
| 94 | dateext |
| 95 | maxage 365 |
| 96 | rotate 99 |
| 97 | size=+1096k |
| 98 | notifempty |
| 99 | missingok |
| 100 | create 644 boinc users |
| 101 | } |
| 102 | /export/projects/predictor/log_predictor1/sample_bitwise_validator.log{ |
| 103 | compress |
| 104 | dateext |
| 105 | maxage 365 |
| 106 | rotate 99 |
| 107 | size=+1096k |
| 108 | notifempty |
| 109 | missingok |
| 110 | create 644 boinc users |
| 111 | } |
| 112 | |
| 113 | /export/projects/predictor/log_predictor1/dataCollectorMFold.log{ |
| 114 | compress |
| 115 | dateext |
| 116 | maxage 365 |
| 117 | rotate 99 |
| 118 | size=+1096k |
| 119 | notifempty |
| 120 | missingok |
| 121 | create 644 boinc users |
| 122 | } |
| 123 | }}} |