An open API service indexing awesome lists of open source software.

https://github.com/iconscout/laravel-auditing-elasticsearch

An elasticsearch driver for the owen-it/laravel-auditing package. Allows storage of the audits in elasticsearch.
https://github.com/iconscout/laravel-auditing-elasticsearch

auditing elasticsearch laravel-auditing

Last synced: 6 months ago
JSON representation

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

Awesome Lists containing this project

README

          

# Auditing Elasticsearch Driver

[![Latest Unstable Version](https://poser.pugx.org/iconscout/laravel-auditing-elasticsearch/v/unstable)](https://packagist.org/packages/iconscout/laravel-auditing-elasticsearch) [![Total Downloads](https://poser.pugx.org/iconscout/laravel-auditing-elasticsearch/downloads)](https://packagist.org/packages/iconscout/laravel-auditing-elasticsearch) [![License](https://poser.pugx.org/iconscout/laravel-auditing-elasticsearch/license)](https://packagist.org/packages/iconscout/laravel-auditing-elasticsearch)

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

## Contents

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

## 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 iconscout/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:

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

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

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

```
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](https://github.com/Iconscout/laravel-auditing-elasticsearch/graphs/contributors) or donating a little.
> Thanks in advance.

Donate directly via [Paypal](https://www.paypal.me/rankarpan)

[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/rankarpan)

More information on using customer drivers with owen-it/laravel-auditing can be found on their [homepage](http://laravel-auditing.com/docs/7.0/audit-drivers)