PHPackages                             1cool/laravel-auditing-elasticsearch - 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. 1cool/laravel-auditing-elasticsearch

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

1cool/laravel-auditing-elasticsearch
====================================

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

2.0(6y ago)29MITPHPPHP &gt;=7.0

Since Jul 8Pushed 6y agoCompare

[ Source](https://github.com/1cool/laravel-auditing-elasticsearch)[ Packagist](https://packagist.org/packages/1cool/laravel-auditing-elasticsearch)[ RSS](/packages/1cool-laravel-auditing-elasticsearch/feed)WikiDiscussions master Synced 1mo ago

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

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

[](#auditing-elasticsearch-driver)

[![Latest Unstable Version](https://camo.githubusercontent.com/76eaee2bab766035bb63d04daf994f0c3b9e6130b1c87292aea9b0a06dbe4b4b/68747470733a2f2f706f7365722e707567782e6f72672f69636f6e73636f75742f6c61726176656c2d6175646974696e672d656c61737469637365617263682f762f756e737461626c65)](https://packagist.org/packages/iconscout/laravel-auditing-elasticsearch) [![Total Downloads](https://camo.githubusercontent.com/99dd3aadc94d773ab28f38df77a1881f0e9ca3b4b5f0e4eef01bf0d10f03eaf3/68747470733a2f2f706f7365722e707567782e6f72672f69636f6e73636f75742f6c61726176656c2d6175646974696e672d656c61737469637365617263682f646f776e6c6f616473)](https://packagist.org/packages/iconscout/laravel-auditing-elasticsearch) [![License](https://camo.githubusercontent.com/31612e22ecde55716631c124b923bcc0a427e2732e06006f7469b8544b86215f/68747470733a2f2f706f7365722e707567782e6f72672f69636f6e73636f75742f6c61726176656c2d6175646974696e672d656c61737469637365617263682f6c6963656e7365)](https://packagist.org/packages/iconscout/laravel-auditing-elasticsearch)

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 1cool/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' => Iconscout\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:

```
