PHPackages                             carlosocarvalho/laravel-auditing-es - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. carlosocarvalho/laravel-auditing-es

ActivePackage[Database &amp; ORM](/categories/database)

carlosocarvalho/laravel-auditing-es
===================================

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

v1.0.2(7y ago)01.1kMITPHPPHP &gt;=7.0

Since Jun 5Pushed 7y ago1 watchersCompare

[ Source](https://github.com/carlosocarvalho-laravel/laravel-auditing-es)[ Packagist](https://packagist.org/packages/carlosocarvalho/laravel-auditing-es)[ RSS](/packages/carlosocarvalho-laravel-auditing-es/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

Auditing Elasticsearch Driver
=============================

[](#auditing-elasticsearch-driver)

This driver provides the ability to save your model audits in elasticsearch.

Contents
--------

[](#contents)

- [Installation](#installation)
- [Setup](#setup)
- [Console commands](#console-commands)
- [Usage](#usage)
- [Donations](#donations)

Installation
------------

[](#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:

```
composer require carlosocarvalho/laravel-auditing-elasticsearch

```

Setup
-----

[](#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:

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

```

OR

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

```

The `driver` key of the config file should look like so:

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

```

The `drivers` key of the config file should look like so:

```
    ...
    '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
----------------

[](#console-commands)

Available artisan commands are listed below:

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.

Usage
-----

[](#usage)

You can use the ElasticSearch driver in any Auditable model like so in order to store audit records in elasticsearch:

```
