diff --git a/airtime_mvc/application/configs/constants.php b/airtime_mvc/application/configs/constants.php index 818e868b5..273b8a0b7 100644 --- a/airtime_mvc/application/configs/constants.php +++ b/airtime_mvc/application/configs/constants.php @@ -86,3 +86,5 @@ define('SOUNDCLOUD_ERROR' , -3); define("WHMCS_API_URL", "https://account.sourcefabric.com/includes/api.php"); define("SUBDOMAIN_WHMCS_CUSTOM_FIELD_NAME", "Choose your domain"); +//Sentry error logging +define('SENTRY_CONFIG_PATH', '/etc/airtime-saas/sentry.airtime_web.ini'); \ No newline at end of file diff --git a/airtime_mvc/application/logging/SentryLogging.php b/airtime_mvc/application/logging/SentryLogging.php index 9b1055b6c..e3c87b700 100644 --- a/airtime_mvc/application/logging/SentryLogging.php +++ b/airtime_mvc/application/logging/SentryLogging.php @@ -1,9 +1,4 @@ sentryClient = null; + return; + } // Instantiate a new client with a compatible DSN - $dsn = 'TODO: FILL ME IN'; + $sentry_config = parse_ini_file(SENTRY_CONFIG_PATH, false); + $dsn = $sentry_config['dsn']; $this->sentryClient = new Raven_Client($dsn, array( //FIXME: This doesn't seem to be working... 'processorOptions' => array( 'Raven_SanitizeDataProcessor' => array( - 'fields_re' => '/(user_password|user_token|user_secret)/i', - 'values_re' => '/^(?:\d[ -]*?){15,16}$/' + 'fields_re' => '/(authorization|password|passwd|user_token|secret|WHMCS_|SESSION)/i', + 'values_re' => '/^(?:\d[ -]*?){13,16}$/' ) ) )); @@ -50,7 +50,12 @@ class SentryLogger public function captureMessage($msg) { + if (!$this->sentryClient) { + return; + } $client = $this->sentryClient; + self::addUserData($client); + self::addTags($client); // Capture a message $event_id = $client->getIdent($client->captureMessage($msg)); @@ -61,8 +66,13 @@ class SentryLogger public function captureException($exception) { + if (!$this->sentryClient) { + return; + } + $client = $this->sentryClient; self::addUserData($client); + self::addTags($client); $event_id = $client->getIdent($client->captureException($exception, array( 'extra' => $this->getExtraData(), @@ -73,13 +83,17 @@ class SentryLogger public function captureError($errorMessage) { + if (!$this->sentryClient) { + return; + } + $client = $this->sentryClient; // Provide some additional data with an exception self::addUserData($client); + self::addTags($client); $event_id = $client->getIdent($client->captureMessage($errorMessage, array( - 'extra' => $this->getExtraData(), - 'tags' => $this->getTags(), + 'extra' => $this->getExtraData() ))); $client->context->clear(); } @@ -87,10 +101,15 @@ class SentryLogger private static function getTags() { $tags = array(); - $tags['dev_env'] = Config::getConfig()["dev_env"]; + $tags['Development Environment'] = Config::getConfig()["dev_env"]; return $tags; } + private static function addTags($client) + { + $client->tags_context(self::getTags()); + } + private static function addUserData($client) { $userData = array(); diff --git a/composer.json b/composer.json index 39a2a6093..6d92538de 100644 --- a/composer.json +++ b/composer.json @@ -2,6 +2,6 @@ "require": { "propel/propel1": "1.7.0-stable", "aws/aws-sdk-php": "2.7.9", - "raven/raven": "0.10.0" + "raven/raven": "0.8.x-dev" } } diff --git a/composer.lock b/composer.lock new file mode 100644 index 000000000..17d9b1085 --- /dev/null +++ b/composer.lock @@ -0,0 +1,441 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "30ad5215f679ce0ab55c7210b21a3b32", + "packages": [ + { + "name": "aws/aws-sdk-php", + "version": "2.7.9", + "source": { + "type": "git", + "url": "https://github.com/aws/aws-sdk-php.git", + "reference": "f39354df58eec97f0ef22ccf3caf753607a47dca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/f39354df58eec97f0ef22ccf3caf753607a47dca", + "reference": "f39354df58eec97f0ef22ccf3caf753607a47dca", + "shasum": "" + }, + "require": { + "guzzle/guzzle": "~3.7", + "php": ">=5.3.3" + }, + "require-dev": { + "doctrine/cache": "~1.0", + "ext-openssl": "*", + "monolog/monolog": "~1.4", + "phpunit/phpunit": "~4.0", + "symfony/yaml": "~2.1" + }, + "suggest": { + "doctrine/cache": "Adds support for caching of credentials and responses", + "ext-apc": "Allows service description opcode caching, request and response caching, and credentials caching", + "ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages", + "monolog/monolog": "Adds support for logging HTTP requests and responses", + "symfony/yaml": "Eases the ability to write manifests for creating jobs in AWS Import/Export" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-0": { + "Aws": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Amazon Web Services", + "homepage": "http://aws.amazon.com" + } + ], + "description": "AWS SDK for PHP - Use Amazon Web Services in your PHP project", + "homepage": "http://aws.amazon.com/sdkforphp", + "keywords": [ + "amazon", + "aws", + "cloud", + "dynamodb", + "ec2", + "glacier", + "s3", + "sdk" + ], + "time": "2014-12-08 21:56:46" + }, + { + "name": "guzzle/guzzle", + "version": "v3.9.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle3.git", + "reference": "54991459675c1a2924122afbb0e5609ade581155" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle3/zipball/54991459675c1a2924122afbb0e5609ade581155", + "reference": "54991459675c1a2924122afbb0e5609ade581155", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "php": ">=5.3.3", + "symfony/event-dispatcher": "~2.1" + }, + "replace": { + "guzzle/batch": "self.version", + "guzzle/cache": "self.version", + "guzzle/common": "self.version", + "guzzle/http": "self.version", + "guzzle/inflection": "self.version", + "guzzle/iterator": "self.version", + "guzzle/log": "self.version", + "guzzle/parser": "self.version", + "guzzle/plugin": "self.version", + "guzzle/plugin-async": "self.version", + "guzzle/plugin-backoff": "self.version", + "guzzle/plugin-cache": "self.version", + "guzzle/plugin-cookie": "self.version", + "guzzle/plugin-curlauth": "self.version", + "guzzle/plugin-error-response": "self.version", + "guzzle/plugin-history": "self.version", + "guzzle/plugin-log": "self.version", + "guzzle/plugin-md5": "self.version", + "guzzle/plugin-mock": "self.version", + "guzzle/plugin-oauth": "self.version", + "guzzle/service": "self.version", + "guzzle/stream": "self.version" + }, + "require-dev": { + "doctrine/cache": "~1.3", + "monolog/monolog": "~1.0", + "phpunit/phpunit": "3.7.*", + "psr/log": "~1.0", + "symfony/class-loader": "~2.1", + "zendframework/zend-cache": "2.*,<2.3", + "zendframework/zend-log": "2.*,<2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.9-dev" + } + }, + "autoload": { + "psr-0": { + "Guzzle": "src/", + "Guzzle\\Tests": "tests/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Guzzle Community", + "homepage": "https://github.com/guzzle/guzzle/contributors" + } + ], + "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2014-08-11 04:32:36" + }, + { + "name": "phing/phing", + "version": "2.9.1", + "source": { + "type": "git", + "url": "https://github.com/phingofficial/phing.git", + "reference": "393edeffa8a85d43636ce0c9b4deb1ff9ac60a5c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phingofficial/phing/zipball/393edeffa8a85d43636ce0c9b4deb1ff9ac60a5c", + "reference": "393edeffa8a85d43636ce0c9b4deb1ff9ac60a5c", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "ext-pdo_sqlite": "*", + "lastcraft/simpletest": "@dev", + "pdepend/pdepend": "1.x", + "pear-pear.php.net/http_request2": "2.2.x", + "pear-pear.php.net/net_growl": "2.7.x", + "pear-pear.php.net/pear_packagefilemanager": "1.7.x", + "pear-pear.php.net/pear_packagefilemanager2": "1.0.x", + "pear-pear.php.net/xml_serializer": "0.20.x", + "pear/pear_exception": "@dev", + "pear/versioncontrol_git": "@dev", + "pear/versioncontrol_svn": "@dev", + "phpdocumentor/phpdocumentor": "2.x", + "phploc/phploc": "2.x", + "phpunit/phpunit": ">=3.7", + "sebastian/phpcpd": "2.x", + "squizlabs/php_codesniffer": "1.5.x" + }, + "suggest": { + "pdepend/pdepend": "PHP version of JDepend", + "pear/archive_tar": "Tar file management class", + "pear/versioncontrol_git": "A library that provides OO interface to handle Git repository", + "pear/versioncontrol_svn": "A simple OO-style interface for Subversion, the free/open-source version control system", + "phpdocumentor/phpdocumentor": "Documentation Generator for PHP", + "phploc/phploc": "A tool for quickly measuring the size of a PHP project", + "phpmd/phpmd": "PHP version of PMD tool", + "phpunit/php-code-coverage": "Library that provides collection, processing, and rendering functionality for PHP code coverage information", + "phpunit/phpunit": "The PHP Unit Testing Framework", + "sebastian/phpcpd": "Copy/Paste Detector (CPD) for PHP code", + "tedivm/jshrink": "Javascript Minifier built in PHP" + }, + "bin": [ + "bin/phing" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.9.x-dev" + } + }, + "autoload": { + "classmap": [ + "classes/phing/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "classes" + ], + "license": [ + "LGPL-3.0" + ], + "authors": [ + { + "name": "Phing Community", + "homepage": "http://www.phing.info/trac/wiki/Development/Contributors" + }, + { + "name": "Michiel Rook", + "email": "mrook@php.net" + } + ], + "description": "PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.", + "homepage": "http://www.phing.info/", + "keywords": [ + "build", + "phing", + "task", + "tool" + ], + "time": "2014-12-03 09:18:46" + }, + { + "name": "propel/propel1", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/propelorm/Propel.git", + "reference": "09058f1443bc287e550b9342a4379aac2e0a0b8f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/propelorm/Propel/zipball/09058f1443bc287e550b9342a4379aac2e0a0b8f", + "reference": "09058f1443bc287e550b9342a4379aac2e0a0b8f", + "shasum": "" + }, + "require": { + "phing/phing": "~2.4", + "php": ">=5.2.4" + }, + "require-dev": { + "pear-pear.php.net/pear_packagefilemanager2": "@stable" + }, + "bin": [ + "generator/bin/propel-gen", + "generator/bin/propel-gen.bat" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7-dev" + } + }, + "autoload": { + "classmap": [ + "runtime/lib", + "generator/lib" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "runtime/lib", + "generator/lib" + ], + "license": [ + "MIT" + ], + "authors": [ + { + "name": "William Durand", + "email": "william.durand1@gmail.com", + "homepage": "http://www.willdurand.fr" + } + ], + "description": "Propel is an open-source Object-Relational Mapping (ORM) for PHP5.", + "homepage": "http://www.propelorm.org/", + "keywords": [ + "Active Record", + "database", + "mapping", + "orm", + "persistence" + ], + "time": "2013-10-21 12:52:56" + }, + { + "name": "raven/raven", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/getsentry/raven-php.git", + "reference": "407d77059c004d4771e8bb1fa50d8b62c850c7e3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/getsentry/raven-php/zipball/407d77059c004d4771e8bb1fa50d8b62c850c7e3", + "reference": "407d77059c004d4771e8bb1fa50d8b62c850c7e3", + "shasum": "" + }, + "require": { + "php": ">=5.2.4" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*" + }, + "bin": [ + "bin/raven" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.8.x-dev" + } + }, + "autoload": { + "psr-0": { + "Raven_": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD" + ], + "authors": [ + { + "name": "David Cramer", + "email": "dcramer@gmail.com" + } + ], + "description": "A PHP client for Sentry (http://getsentry.com)", + "homepage": "http://getsentry.com", + "keywords": [ + "log", + "logging" + ], + "time": "2015-01-23 20:50:15" + }, + { + "name": "symfony/event-dispatcher", + "version": "v2.6.3", + "target-dir": "Symfony/Component/EventDispatcher", + "source": { + "type": "git", + "url": "https://github.com/symfony/EventDispatcher.git", + "reference": "40ff70cadea3785d83cac1c8309514b36113064e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/40ff70cadea3785d83cac1c8309514b36113064e", + "reference": "40ff70cadea3785d83cac1c8309514b36113064e", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.0,>=2.0.5", + "symfony/dependency-injection": "~2.6", + "symfony/expression-language": "~2.6", + "symfony/stopwatch": "~2.3" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\EventDispatcher\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "http://symfony.com", + "time": "2015-01-05 14:28:40" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "raven/raven": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +}