2017 © Pedro Peláez
 

library piton

PSR-3 Compatible Splunk Storm Logging

image

stechstudio/piton

PSR-3 Compatible Splunk Storm Logging

  • Thursday, August 28, 2014
  • by bubba
  • Repository
  • 7 Watchers
  • 0 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

PITON

The PSR-3 Compliant SplunkStorm Logger for PHP

Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

Piton was developed in order to allow simple access to the SplunkStorm REST API from PHP code. While we use the SplunkStorm log shippers for the majority of our applications, we ran into cases of short lived tasks, running on short lived EC2 instances, that didn't warrant setting up log shipping., (*2)

However, we did desire the ability to capture the logs on SplunkStorm. Because the majority of these tasks run on Iron.io's IronWorker and are CLI based, we also desired the ability to log to the console. Thus, our logger ships with console and splunk appenders., (*3)

We also happen to think highly of the PHP FIG standards, and desire to meet them where possible. After writing the logger for ourselves, we decided others might want to leverage it to, and are releasing it into the wild., (*4)

Build Status Code Coverage
Master Build Status Coverage Status
Develop Build Status Coverage Status

Installation / Usage

  1. Download the composer.phar executable or use the installer., (*5)

    sh $ curl -sS https://getcomposer.org/installer | php, (*6)

  2. Create a composer.json defining your dependencies. Note that this example is a short version for applications that are not meant to be published as packages themselves. To create libraries/packages please read the documentation., (*7)

    json { "require": { "stechstudio/piton": ">=0.1.1" } }, (*8)

  3. Run Composer: php composer.phar install, (*9)

  4. Browse for more packages on Packagist.

Documentations

Check out the docs/api directory., (*10)

Examples

Check out the examples directory., (*11)

Quickstart

You will need a SplunkStorm Project API Hostname, Project ID, and Access Token. You can find them in the data section of your SplunkStorm Project. Select Data, the API, and you will find everything you need., (*12)


$allAppenders = [ 'logger' => ['level' => 'info'], 'appenders' => [ 'console' => [ 'target' => 'STDOUT', 'class' => 'Piton\Appender\Console' ], 'null' => ['class' => 'Piton\Appender\Null'], 'splunk' => [ 'target' => 'api-fake.data.splunkstorm.com', 'class' => 'Piton\Appender\SplunkStorm', 'context' => [ 'SplunkStorm' => [ 'projectID' => 'SomeFakeProjectID', 'accessToken' => 'AnotherFakeAccessToken', 'apiVersion' => 1, 'apiEndpoint' => 'inputs/http', 'urlScheme' => 'https' ] ] ] ] ]; $logger = new Logger($allAppenders); $logger->setLevel('all'); $requireMessageFormat = '{TIMESTAMP} app="SimpleConsoleLogging" level="{LOGLEVEL}" file="{file}" line={line} class="{class}" msg="{MESSAGE}" '; $logger->setAndEnableRequiredMessage($requireMessageFormat, true); runLogMessages('Because we log to SplunkStorm, and we PWN our logs!', ['file'=>__FILE__,'class'=>__CLASS__, 'line'=>__LINE__]); function runLogMessages($message, $context = array()){ global $logger; $logger->fatal($message, $context); $logger->emergency($message, $context); $logger->alert($message, $context); $logger->critical($message, $context); $logger->error($message, $context); $logger->warning($message, $context); $logger->notice($message, $context); $logger->info($message, $context); $logger->debug($message, $context); $logger->trace($message, $context); }

The Versions

28/08 2014

dev-master

9999999-dev https://github.com/stechstudio/Piton

PSR-3 Compatible Splunk Storm Logging

  Sources   Download

MIT

The Requires

 

The Development Requires

logger log psr-3 logging splunk splunkstorm

28/08 2014

0.1.5

0.1.5.0 https://github.com/stechstudio/Piton

PSR-3 Compatible Splunk Storm Logging

  Sources   Download

MIT

The Requires

 

The Development Requires

logger log psr-3 logging splunk splunkstorm

28/08 2014

dev-develop

dev-develop https://github.com/stechstudio/Piton

PSR-3 Compatible Splunk Storm Logging

  Sources   Download

MIT

The Requires

 

The Development Requires

logger log psr-3 logging splunk splunkstorm

27/08 2014

0.1.4

0.1.4.0 https://github.com/stechstudio/Piton

PSR-3 Compatible Splunk Storm Logging

  Sources   Download

MIT

The Requires

 

The Development Requires

logger log psr-3 logging splunk splunkstorm

25/08 2014

0.1.3

0.1.3.0 https://github.com/stechstudio/Piton

PSR-3 Compatible Splunk Storm Logging

  Sources   Download

MIT

The Requires

 

The Development Requires

logger log psr-3 logging splunk splunkstorm

22/08 2014

0.1.1

0.1.1.0 https://github.com/stechstudio/Piton

PSR-3 Compatible Splunk Storm Logging

  Sources   Download

MIT

The Requires

 

The Development Requires

logger log psr-3 logging splunk splunkstorm

22/08 2014

0.1.0

0.1.0.0 https://github.com/stechstudio/Piton

PSR-3 Compatible Splunk Storm Logging

  Sources   Download

MIT

The Requires

 

The Development Requires

logger log psr-3 logging splunk splunkstorm