Package: rollbar-agent
rollbar-agent is a Python daemon that can monitor log files and push messages to Rollbar. It can monitor:.rollbarfiles written by a Rollbar notifier library (currently supported in rollbar-php, pyrollbar, and rollbar-agent)Python-style log files(Other log files formats are currently not supported out of the box.)Who Should Use rollbar-agentIf you are trying to monitor your application’s log files, we recommend using a Rollbar notifier library instead
(or in addition, in the case of PHP–see next paragraph). The Rollbar notifiers are easier to install and use and will gather more
context about each error. Seehttps://rollbar.com/docsfor a list of supported languages and links to notifiers.Today, the primary use of rollbar-agent is to provide durable, asynchronous reporting from PHP applications
that are instrumented with rollbar-php. If you are using PHP and performance is important, you’ll want to set up
rollbar-agent.For almost everyone else, rollbar-agent is more complexity than needed when getting started; most other platforms
provide easier ways to do asynchronous reporting that don’t require running a separate process. However, rollbar-agent
may still be desirable if:you want to minimize work done in your application process, even if it’s in a background threaddurability is important (i.e. it’s important that reports to Rollbar succeed even if the main process dies, or that they eventually succeed if the network is temporarily unavailable)Installing and configuring rollbar-agent will be much easier if you have a basic understanding of
Python virtualenvs and are comfortable editing the configuration files that control services
on your OS.Requirementsrollbar-agent requires:A unix-like system (tested on Fedora and Ubuntu Linux and Mac OS X)Python 3 or 2.6+requests 0.13.1+ (will be installed by pip or setup.py, below)aRollbaraccountSet up a virtualenvYou can install rollbar-agent by using pip, by checking out the code from the GitHub repository, or by
downloading a tar file. In each case, you’ll be installing rollbar-agent into a Python virtualenv. If
you don’t already have an appropriate virtualenv set up, you should create one now. For more information
on Python virtual environments, seehttp://docs.python-guide.org/en/latest/dev/virtualenvs/Install rollbar-agentOnce you’ve created and activated your virualenv, install the rollbar-agent code and configuration files
into that environment using your preferred method below. Each method will install the rollbar-agent library
and put the configuration and service start up files you’ll need into the root directory of your virtualenv.Installing with pipIf you’re familiar with pip, you can install rollbar-agent with:pip install rollbar-agentInstalling from sourceIf you’re comfortable with Git:git clone https://github.com/rollbar/rollbar-agent.git
cd rollbar-agentOr just grab the .tar.gz:wget https://github.com/rollbar/rollbar-agent/archive/v0.5.1.tar.gz
tar -xzf v0.5.1
cd rollbar-agent-0.5.1Then install (may require sudo):python setup.py installSet up the rollbar-agent serviceSymlink the rollbar-agent executable to /usr/local/rollbar-agent:ln -s /path/to/virtualenv/rollbar-agent /usr/local/rollbar-agentand symlink the rollbar-agent configuration file to /etc/rollbar-agent.conf:ln -s /path/to/virtualenv/rollbar-agent.conf /etc/rollbar-agent.confinit.d scriptrollbar-agent comes with an example init.d script, chkconfig compatible and tested on Fedora Linux, update-rc.d on Ubuntu Linux. You’ll need
to edit this script and make sure theVIRTUALENVenvironment variable contains the path to the virtual environment you set up.Once you’ve edited the rollbar-agent-init.sh script, symlinkrollbar-agent-init.shto/etc/init.d/rollbar-agent:chmod +x /path/to/virtualenv/rollbar-agent-init.sh
ln -s /path/to/virtualenv/rollbar-agent-init.sh /etc/init.d/rollbar-agentOn Ubuntu, you’ll need to add to rc.d. Run the following:update-rc.d rollbar-agent defaultsOn Fedora, add to chkconfig:chkconfig --add rollbar-agent
chkconfig on rollbar-agentOn other systems, check your system’s documentation for its equivalent of chkconfig.Now, start the service:service rollbar-agent startTo check that it’s running, tail its log file:tail -f /var/log/rollbar-agent.logConfigurationConfiguration options for rollbar-agent itself are inrollbar-agent.conf. If you’re using the init script, it has a few of its own configuration variables inside which control how it runs.rollbar-agent.confAt the bare minimum, you will want to change the following variables:params.access_token– your Rollbar access token, specifically an API token that allows “post_server_item”targets– white-space-separated list of files or directories (non-recursive) to process.statefile– path to a file where the state will be stored. File does not need to exist, but the directory does. This file shouldnotbe placed somewhere it is likely to be deleted, as that will trigger all files to be re-processed./tmpis not a good location.There are several parameters about formats, etc.; you do NOT need to do anything with these if you’re only using rollbar-agent as a relay in combination with one of our other libraries.Setting the following variables will improve integration:params.root– path to your code rootparams.branch– the current branchIf you’re using rollbar-agent alongside rollbar-php, you’ll want to enable:delete_processed_files– when true, files are deleted once processing is complete. Default false.If your logs are capturing terminal escape sequences such as color / boldness, you may want to setfilter_chr_attr_sequences = true.  This will clean all output of character attribute terminal sequences.Other options are documented in the sample config file.rollbar-agent-init.shConfiguration variables should be self-explanatory. If you’re not using a virtualenv, setVIRTUALENV="".ContributingContributions are welcome. The project is hosted on github athttp://github.com/rollbar/rollbar-agentAdditional HelpIf you have any questions, feedback, etc., drop us a line atteam@rollbar.com