Comments (7)
Can you figure out what version of elastic it is using?
from audit-stash.
Elastica
from audit-stash.
Yes, of course ;)
https://github.com/ruflin/Elastica/releases/tag/2.3.1
Installed via composer dependency.
from audit-stash.
Hi
Ive just switched to my own persister.
Could you have a quick look if its a good practice to split the meta data into individual fields and jsonify the original and changed data?
namespace App\Persister;
use AuditStash\PersisterInterface;
use Cake\ORM\Entity;
use Cake\ORM\TableRegistry;
class DatabasePersister implements PersisterInterface
{
public function logEvents(array $auditLogs)
{
//pr($auditLogs);
//die();
foreach ($auditLogs as $log) {
$eventType = $log->getEventType();
$data = [
'timestamp' => $log->getTimestamp(),
'transaction' => $log->getTransactionId(),
'type' => $log->getEventType(),
'primary_key' => $log->getId(),
'source' => $log->getSourceName(),
'parent_source' => $log->getParentSourceName(),
'original' => ($eventType === 'create' || $eventType === 'delete') ? null : json_encode($log->getOriginal()),
'changed' => $eventType === 'delete' ? null : json_encode($log->getChanged()),
'ip' => $log->getMetaInfo()['ip'],
'url' => $log->getMetaInfo()['url'],
'user_id' => $log->getMetaInfo()['user'],
];
TableRegistry::get('Audits')->save(new Entity($data));
}
}
}
And Ive had no luck to populate get the orignal data at the delete event. I think it makes sense to log the original data here. Any idea how to get this in the method above?
Thanks,
Frank
from audit-stash.
@LDSign The error seems to come from the library, not the plugin.. which is odd. It is not a bad idea to do what you are doing. I originally stored the fields in Mysql, but became very slow, consumed a lot of space and could not search freely on the fields. If you only want to store, then that is entirely fine
from audit-stash.
I had the same errors but using the built-in elastic search Persister. I was using ElasticSearch 5.5. I downgraded to 2.4.6 and it works. Looks like the issue is an incompatibility at the ruflin/Elastica level. Thank you for the plugin @lorenzo
from audit-stash.
@LDSign $log->getMetaInfo()
returns null in my case. Any idea why? The rest works fine per your example.
from audit-stash.
Related Issues (20)
- Exception: No handler for type [string] declared on field [transaction] HOT 2
- audit-stash not working when updating multiple rows together HOT 7
- Syntax error in 2.0.0 release HOT 1
- deprecation warning for ServerRequest::here() HOT 3
- Deprecated field type error when running elastic_mapping shell HOT 2
- Multiple index guide incorrect HOT 3
- Throws an SQL incorrect syntax error on test HOT 2
- Inserting stringifiable objects HOT 2
- Implement JSON field types HOT 3
- CakePHP 4 compatibility HOT 5
- Can't find %s in the configuration guide for daily index HOT 1
- psr-4 autoloading standard warning in composer 1.10 HOT 2
- AuditLogsType.php does not comply with psr-4 autoloading standard. HOT 2
- String datetime changes may break custom DateTimeType implementations HOT 1
- Log associative model HOT 4
- Logging Cascading Deletes HOT 1
- Rename AuditLogsType.php file to AuditLogsIndex.php
- Your requirements could not be resolved to an installable set of packages
- Tests fail on my local
- CakePHP 5 Support HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from audit-stash.