2017 © Pedro Peláez
 

library dtail

Prints PHP Errors that have been logged to DynamoDB

image

otternq/dtail

Prints PHP Errors that have been logged to DynamoDB

  • Sunday, November 17, 2013
  • by otternq
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

DTail

Watch and search Logs entries stored in a DynamoDB table, (*1)

Total Downloads Latest Stable Version Dependency Status, (*2)

Master Development
Build Status Build Status
Coverage Status Coverage Status

Installing

DTail is available on Packagist., (*3)

To install with composer, add: "otternq/dtail": "dev-master" to composer.json in the require section:, (*4)

"require": {
    "php": ">=5.3.3",
    "otternq/dtail": "dev-master"
}

then run php composer.phar update (or php composer.phar install depending on the situation) and let composer do the rest., (*5)

Usage

If you want to incoorperate this into another system, see Usage 1. If you just want to see the log entries, see Usage 2, (*6)

Usage 1

include "vendor/autoload.php";

use Colors\Color;

use Aws\Common\Aws;
use Aws\DynamoDb\DynamoDbClient;

use DTail\DTail;

$config = array(
    'dyn-table' => 'PHPErrors',
    'dyn-key'    => YOUR_AWS_KEY,
    'dyn-secret' => YOUR_AWS_SECRET,
    'dyn-region' => 'us-east-1'
);

$dynamodbClient = DynamoDbClient::factory(array(
    'key'    => $config['dyn-key'],
    'secret' => $config['dyn-secret'],
    'region' => $config['dyn-region'],
    )
);

$dtail = new DTail($dynamodbClient);

$iterator = $dtail->get(
    $config['dyn-table'], 
    'PHPErrorReporter'
);

foreach($iterator as $item) {
    var_dump($item);
}

Usage 2

If you just want to watch/search log files then use the bin/dtail command:, (*7)

bin/dtail -f /path/to/config/file.php

the config file will look like:, (*8)

return array(
    'dyn-table' => 'PHPErrors',
    'dyn-key'    => YOUR_AWS_KEY,
    'dyn-secret' => YOUR_AWS_SECRET,
    'dyn-region' => 'us-east-1'
);

and the output will look like:, (*9)

Channel           Date Time   Level      Message                                                      Context
PHPErrorReporter  2013-11-14  WARNING    Test                                                         []
PHPErrorReporter  2013-11-14  WARNING    E_WARNING: Division by zero                                  {"file":"/path/to/DTail/app.php","line":26}
PHPErrorReporter  2013-11-14  NOTICE     E_NOTICE: Undefined variable: foo                            {"file":"/path/to/DTail/error.php","line":27}
PHPErrorReporter  2013-11-14  WARNING    E_WARNING: Division by zero                                  {"file":"/path/to/DTail/error.php","line":28}
PHPErrorReporter  2013-11-14  NOTICE     E_NOTICE: Use of undefined constant T - assumed 'T'          {"file":"/path/to/DTail/error.php","line":29}
PHPErrorReporter  2013-11-14  ERROR      Uncaught exception                                           {"exception":{"class":"Exception","message":"$arr has no element with index: dyn->key","file":"/path/to/DTail/Utils/Arr.php:26","trace":["/path/to/DTail/bin/app.php:36"]}}

DynamoDB

This tool was written to read log messages stored by monolog using the DynamoDB handler and the DynamoDB structure is displayed on Issue 259., (*10)

The Versions

17/11 2013

dev-master

9999999-dev https://github.com/otternq/DTail

Prints PHP Errors that have been logged to DynamoDB

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nick Otter

dynamodb logs

17/11 2013

dev-development

dev-development https://github.com/otternq/DTail

Prints PHP Errors that have been logged to DynamoDB

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nick Otter

dynamodb logs

15/11 2013

0.2

0.2.0.0 https://github.com/otternq/DTail

Prints PHP Errors that have been logged to DynamoDB

  Sources   Download

MIT

The Requires

 

by Nick Otter

dynamodb logs

15/11 2013

0.1

0.1.0.0 https://github.com/otternq/DTail

Prints PHP Errors that have been logged to DynamoDB

  Sources   Download

MIT

The Requires

 

by Nick Otter

dynamodb logs