2017 © Pedro Peláez
 

package laravel-auditing-es

A elasticsearch driver for the owen-it/laravel-auditing package. Allows storage of the audits in elasticsearch.

image

carlosocarvalho/laravel-auditing-es

A elasticsearch driver for the owen-it/laravel-auditing package. Allows storage of the audits in elasticsearch.

  • Tuesday, June 5, 2018
  • by carlosocarvalho
  • Repository
  • 1 Watchers
  • 0 Stars
  • 67 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Auditing Elasticsearch Driver

This driver provides the ability to save your model audits in elasticsearch., (*1)

Contents

Installation

This driver requires that you are using owen-it/laravel-auditing: ^7.0. Provided this is fulfilled, you can install the driver like so:, (*2)

composer require carlosocarvalho/laravel-auditing-elasticsearch

Setup

You need to add the following config entries in config/audit.php if you need to change the default behaviour of the driver. The queue key of the config file should look like so:, (*3)

    ...
    'queue' => env('AUDIT_QUEUE', true),
    ...

OR, (*4)

    ...
    'queue' => env('AUDIT_QUEUE', [
        'queue' => 'default',
        'connection' => 'redis'
    ]),
    ...

The driver key of the config file should look like so:, (*5)

    ...
    'driver' => CarlosOCarvalho\Auditing\Drivers\ElasticSearch::class,
    ...

The drivers key of the config file should look like so:, (*6)

    ...
    'drivers' => [
        'database' => [
            'table'      => 'audits',
            'connection' => null,
        ],
        'es' => [
            'client' => [
                'hosts' => [
                    env('AUDIT_HOST', 'localhost:9200')
                ]
            ],
            'index' => env('AUDIT_INDEX', 'laravel_auditing'),
            'type' => env('AUDIT_TYPE', 'audits')
        ],
    ],
    ...

Console commands

Available artisan commands are listed below:, (*7)

Command Arguments Description
auditing:es-index Index all of the model's records into the search index.
auditing:es-delete Delete all of the model's records from the index.

For detailed description and all available options run php artisan help [command] in the command line., (*8)

Usage

You can use the ElasticSearch driver in any Auditable model like so in order to store audit records in elasticsearch:, (*9)

<?php
namespace App\Models;

use Iconscout\Auditing\Drivers\ElasticSearch;
use Illuminate\Database\Eloquent\Model;
use OwenIt\Auditing\Auditable;
use OwenIt\Auditing\Contracts\Auditable as AuditableContract;

class SomeModel extends Model implements AuditableContract
{
    use Auditable;

    /**
     * ElasticSearch Audit Driver
     *
     * @var Iconscout\Auditing\Drivers\ElasticSearch
     */
    protected $auditDriver = ElasticSearch::class;

    // ...
}

You can use the ElasticSearchAuditable trait in any Auditable model like so in order to retrieving Retrieving audit records records from elasticsearch:, (*10)

<?php
namespace App\Models;

use Iconscout\Auditing\Drivers\ElasticSearch;
use Iconscout\Auditing\Traits\ElasticSearchAuditable;
use Illuminate\Database\Eloquent\Model;
use OwenIt\Auditing\Auditable;
use OwenIt\Auditing\Contracts\Auditable as AuditableContract;

class SomeModel extends Model implements AuditableContract
{
    use Auditable, ElasticSearchAuditable;

    /**
     * ElasticSearch Audit Driver
     *
     * @var Iconscout\Auditing\Drivers\ElasticSearch
     */
    protected $auditDriver = ElasticSearch::class;

    // ...
}
// Get first available Icon
$icon = Icon::first();

// Get all associated Audits
$all = $icon->esAudits;

// Get all associated Audits via parameters ($page & $perPage)
$all = $icon->esAudits($page = 1, $perPage = 10);

Donations

Help keeping the project development going, by contributing or donating a little. Thanks in advance., (*11)

Donate directly via Paypal, (*12)

Donate, (*13)

More information on using customer drivers with owen-it/laravel-auditing can be found on their homepage, (*14)

The Versions

05/06 2018

dev-master

9999999-dev

A elasticsearch driver for the owen-it/laravel-auditing package. Allows storage of the audits in elasticsearch.

  Sources   Download

MIT

The Requires

 

by Carlos Carvalho

laravel log lumen logging eloquent elasticsearch tracking revision es audit history record auditing observer changes accountability

05/06 2018

v1.0.2

1.0.2.0

A elasticsearch driver for the owen-it/laravel-auditing package. Allows storage of the audits in elasticsearch.

  Sources   Download

MIT

The Requires

 

by Carlos Carvalho

laravel log lumen logging eloquent elasticsearch tracking revision es audit history record auditing observer changes accountability

05/06 2018

v1.0.1

1.0.1.0

A elasticsearch driver for the owen-it/laravel-auditing package. Allows storage of the audits in elasticsearch.

  Sources   Download

MIT

The Requires

 

by Carlos Carvalho

laravel log lumen logging eloquent elasticsearch tracking revision es audit history record auditing observer changes accountability

05/06 2018

v1.0.0

1.0.0.0

A elasticsearch driver for the owen-it/laravel-auditing package. Allows storage of the audits in elasticsearch.

  Sources   Download

MIT

The Requires

 

by Arpan Rank

laravel log lumen logging eloquent elasticsearch tracking revision es audit history record auditing observer changes accountability