Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated audit entries #330

Open
samuel4x4 opened this issue Nov 1, 2022 · 6 comments
Open

Duplicated audit entries #330

samuel4x4 opened this issue Nov 1, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@samuel4x4
Copy link
Contributor

samuel4x4 commented Nov 1, 2022

Q A
auditor-bundle version 5.1.0
PHP version 8.1.7
Database MySQL

Summary

Entries are duplicated on the audit database tables for all actions: INSERT, UPDATE, ASSOCIATE.

Current behavior

Multiple similar entries are added on the entity audit tables for the same object_id, including for INSERT operation, which can't really happen with the same id. I have for example up to 12 similar entries sometimes.

How to reproduce

Any normal operation executed on an audited entity generates duplicated audit entries.

Expected behavior

Audit entries should be added only once on the database.

Example:

SELECT * FROM companies_audit;

id,type,object_id,diffs,created_at
955,insert,60,"{""@source"":{""id"":60,""class"":""App\\Core\\Entity\\Company"...",2022-11-01 21:52:43.754603
955,insert,60,"{""@source"":{""id"":60,""class"":""App\\Core\\Entity\\Company"...",2022-11-01 21:52:43.762118
989,update,60,"{""scoring"":{""new"":""2.5"",""old"":null}}",2022-11-01 21:52:43.822860
994,update,60,"{""scoring"":{""new"":""2.5"",""old"":null}}",2022-11-01 21:52:43.830166
@samuel4x4 samuel4x4 added the bug Something isn't working label Nov 1, 2022
@dmitryuk
Copy link
Contributor

We need more info to reproduce an error.
@samuel4x4 can you provide your dh_auditor config?

@DamienHarper
Copy link
Owner

@samuel4x4 I confirm the need to get more information about your current config/setup, I haven't been able to reproduce the issue on my side.

@DamienHarper
Copy link
Owner

@samuel4x4 any chance to get more information about your current config/setup?

@Navds
Copy link

Navds commented Feb 13, 2023

Samy issue.

  • damienharper/auditor-bundle: 5.2.1
  • symfony: 5.4.19
  • php: 7.4

dh_auditor.yaml:

dh_auditor:
    timezone: 'Europe/Paris'
    enabled: true
    providers:
        doctrine:
            table_prefix: null
            table_suffix: '_audit'
            ignored_columns:
                - createdAt
                - updatedAt
                - id
            entities:
                App\Data\Entity\LMS\Course: ~

services.yaml:

    DH\Auditor\Provider\Doctrine\Auditing\Transaction\TransactionManager:
        arguments: [ '@DH\Auditor\Provider\Doctrine\DoctrineProvider' ]

    DH\Auditor\Provider\Doctrine\Auditing\Event\DoctrineSubscriber:
        arguments: [ '@DH\Auditor\Provider\Doctrine\Auditing\Transaction\TransactionManager' ]
        tags:
            - { name: doctrine.event_subscriber }

@dmitryuk
Copy link
Contributor

@Navds Why you define Auditor services manually? It defines automatically within container compile time.

@Navds
Copy link

Navds commented Feb 13, 2023

I don't remember exactly why but it didn't work before and I followed the advice at #251
But indeed, the duplication is solved by removing these service definitions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants