Skip to content

Activity Log Rotation

Michael J Pearson edited this page Dec 1, 2015 · 1 revision

bip.io running under high load will rapidly fill the bip_logs collection in bip.io's MongoDB database.

These logs can be archived into monthly shards by running the script

./tools/archive.logs.js

The default policy is to archive anything older than 2 months, into monthly chunks, for example the created collection bip_logs_201507 will contain all logs from July 2015.

You can of course run this manually, but here is a sample monthly cron script for reference.

#!/bin/bash
export NODE_ENV=production
export HOME="/var/local/bipio/server"
NOWDATE=`date +"%Y%m%d"`
cd $HOME
node ./tools/archive_logs.js >> ${HOME}/logs/archive_${NOWDATE}.log 2>&1
Clone this wiki locally