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.
- Host: GitHub
- URL: https://github.com/iconscout/laravel-auditing-elasticsearch
- Owner: Iconscout
- License: mit
- Archived: true
- Created: 2018-03-08T09:03:40.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-12-05T15:34:20.000Z (almost 7 years ago)
- Last Synced: 2025-03-11T22:34:37.312Z (7 months ago)
- Topics: auditing, elasticsearch, laravel-auditing
- Language: PHP
- Homepage:
- Size: 17.6 KB
- Stars: 22
- Watchers: 3
- Forks: 20
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Auditing Elasticsearch Driver
[](https://packagist.org/packages/iconscout/laravel-auditing-elasticsearch) [](https://packagist.org/packages/iconscout/laravel-auditing-elasticsearch) [](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)
[](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)