Tracking user activity logs using Loggastic #ApiPlatformCon

by Paula Čučuk, Locastic 21.9.2023. / API Platform Conference 2023
Tracking user activity
logs using Loggastic
Paula Čučuk
paula@locastic.com
@paoolala
Partner & Lead backend developer @ Locastic
Software solutions for
business challenges.
locastic.com
Intro
The goal
Track each change made on data + custom actions not related to database
changes
Ability to define which data should be tracked, including fields from relations
User friendly logs view
Support for large amount of data and fast browsing
Logging should not slow down the response time
What should log contain?
Entity name
Action (create, edit, delete)
Datetime
Before/after values
User
Existing solutions
Loggable behavioural
Doctrine extension
Loggable behavioural Doctrine extension
Loggable behavioural Doctrine extension
Track each change made on data + custom actions not related to changing data
Ability to define which data should be tracked, including fields from relations
User friendly logs view
Support for large amount of data and fast browsing
Logging should not slow down the response time
EXTRA: Ability to rollback the data to the previous state
Loggastic
Loggastic - logging flow
Listen loggable
objects actions
CREATE
EDIT
DELETE
Send message to
Symfony
messenger
Compare data Elastic
Search
Loggastic - displaying logs
Elastic
Search
Read logs
Expose to
ApiPlatform
endpoint
Expose to Twig
view
Loggastic - elastic indexes
<entity_name>_activity_log
<entity_name>_current_data_tracker
Contains current
object data used for
comparing changed
object
Needs to be up to date
with database values
Contains actual
activity logs for
current object
Loggastic
implementation
1. Installation
composer require locastic/loggastic
2. Making an entity loggable
2. Making an entity loggable
2. Making an entity loggable
2. Making an entity loggable
3. Run commands for creating Elastic indexes
bin/console locastic:activity-logs:create-loggable-indexes
bin/console locastic:activity-logs:populate-current-data-trackers
If you already have some data in database:
Done! Activity logs are now tracked
Create product
Edit product
Delete product
4. Displaying activity logs
Displaying activity logs : Api platform
Displaying activity logs : Api platform
Displaying activity logs : Api platform
Displaying activity logs : Twig
Displaying activity logs : Twig
Basic implementation summary
Add Loggable attribute to entity and serialization groups to
properties
Run command for creating indexes
Expose an api endpoint or display logs in twig
Customizations
Configuration reference
Configuration
reference -
Elastic indexes
Customising logged data
Custom user fields
Custom user fields
Custom user fields
Custom user fields
Collection keys
Custom Collection keys
Handeling relations
Activity log is not saved!
Handeling relations
Handeling relations
Changing the default
loggable listener
Turning off the default listener
Creating your own listener
Creating
your own
listener
Custom action name
Save edit log when no changes were made
Optimisation
Making logs async
Different consumers per entity (AMQP)
Different consumers per entity
Pros / Cons
Pros
Quick and easy implementation
Flexible & customisable
Meets all of our goals
Helpful in debugging
Complex setup
Keeping data up to date
Cons
How does it work
on real projects?
1.5 million
Number of activity
Log records
< 200ms
Sylius & ApiPlatform project
GET /activity-logs
response time
Future plans
Future plans
Add support for other data storages
Add more abilities for customisation
Sylius plugin
Keep testing it and fix any found issues
Contributing
Thank you!
Questions?
Paula Čučuk
paula@locastic.com
@paoolala
Partner & Lead backend developer @ Locastic
1 of 64

Recommended

UCIAD overview by
UCIAD overviewUCIAD overview
UCIAD overviewMathieu d'Aquin
830 views26 slides
Spring 15 by
Spring 15Spring 15
Spring 15Jyothylakshmy P.U
321 views18 slides
Best practices for migrating from SharePoint Designer to Power Automate by
Best practices for migrating from SharePoint Designer to Power AutomateBest practices for migrating from SharePoint Designer to Power Automate
Best practices for migrating from SharePoint Designer to Power AutomateWilliam Huneycutt, II
1.1K views60 slides
Stefaan Ponnet, Fusebox by
Stefaan Ponnet, FuseboxStefaan Ponnet, Fusebox
Stefaan Ponnet, Fuseboxnascomgenk
1.6K views27 slides
ELK Solutions Enablement Session - 17th March'2020 by
ELK Solutions Enablement Session - 17th March'2020ELK Solutions Enablement Session - 17th March'2020
ELK Solutions Enablement Session - 17th March'2020Ashnikbiz
156 views55 slides
Getting It System Toolkit: Enhancing User Experience & Customizing a Future f... by
Getting It System Toolkit: Enhancing User Experience & Customizing a Future f...Getting It System Toolkit: Enhancing User Experience & Customizing a Future f...
Getting It System Toolkit: Enhancing User Experience & Customizing a Future f...Tim Bowersox
181 views53 slides

More Related Content

Similar to Tracking user activity logs using Loggastic #ApiPlatformCon

Alfresco Day Amsterdam 2015, Technical Track - Doing more with Activiti by
Alfresco Day Amsterdam 2015, Technical Track - Doing more with ActivitiAlfresco Day Amsterdam 2015, Technical Track - Doing more with Activiti
Alfresco Day Amsterdam 2015, Technical Track - Doing more with ActivitiAlfresco Software
512 views10 slides
Admin Tech Clash: Discussing Best (and Worst) Administration Practices from ... by
Admin Tech Clash: Discussing Best (and Worst) Administration Practices from  ...Admin Tech Clash: Discussing Best (and Worst) Administration Practices from  ...
Admin Tech Clash: Discussing Best (and Worst) Administration Practices from ...Christoph Adler
226 views66 slides
Data Ingestion in Big Data and IoT platforms by
Data Ingestion in Big Data and IoT platformsData Ingestion in Big Data and IoT platforms
Data Ingestion in Big Data and IoT platformsGuido Schmutz
2.9K views59 slides
1 content optimization-hug-2010-07-21 by
1 content optimization-hug-2010-07-211 content optimization-hug-2010-07-21
1 content optimization-hug-2010-07-21Hadoop User Group
1.5K views18 slides
Pentaho data integration 4.0 and my sql by
Pentaho data integration 4.0 and my sqlPentaho data integration 4.0 and my sql
Pentaho data integration 4.0 and my sqlAHMED ENNAJI
758 views39 slides
Tracking Active Directory Changes by
Tracking Active Directory ChangesTracking Active Directory Changes
Tracking Active Directory ChangesVyapin Software Systems Private Limited
421 views15 slides

Similar to Tracking user activity logs using Loggastic #ApiPlatformCon(20)

Alfresco Day Amsterdam 2015, Technical Track - Doing more with Activiti by Alfresco Software
Alfresco Day Amsterdam 2015, Technical Track - Doing more with ActivitiAlfresco Day Amsterdam 2015, Technical Track - Doing more with Activiti
Alfresco Day Amsterdam 2015, Technical Track - Doing more with Activiti
Alfresco Software512 views
Admin Tech Clash: Discussing Best (and Worst) Administration Practices from ... by Christoph Adler
Admin Tech Clash: Discussing Best (and Worst) Administration Practices from  ...Admin Tech Clash: Discussing Best (and Worst) Administration Practices from  ...
Admin Tech Clash: Discussing Best (and Worst) Administration Practices from ...
Christoph Adler226 views
Data Ingestion in Big Data and IoT platforms by Guido Schmutz
Data Ingestion in Big Data and IoT platformsData Ingestion in Big Data and IoT platforms
Data Ingestion in Big Data and IoT platforms
Guido Schmutz2.9K views
1 content optimization-hug-2010-07-21 by Hadoop User Group
1 content optimization-hug-2010-07-211 content optimization-hug-2010-07-21
1 content optimization-hug-2010-07-21
Hadoop User Group1.5K views
Pentaho data integration 4.0 and my sql by AHMED ENNAJI
Pentaho data integration 4.0 and my sqlPentaho data integration 4.0 and my sql
Pentaho data integration 4.0 and my sql
AHMED ENNAJI758 views
Audit logging by Son Nguyen
Audit loggingAudit logging
Audit logging
Son Nguyen1.1K views
Salesforce Spring 14 Release Developer Overview by Roy Gilad
Salesforce Spring 14 Release Developer OverviewSalesforce Spring 14 Release Developer Overview
Salesforce Spring 14 Release Developer Overview
Roy Gilad3.9K views
Meetup milano #4 log management and anypoint advanced monitoring by Gonzalo Marcos Ansoain
Meetup milano #4   log management and anypoint advanced monitoringMeetup milano #4   log management and anypoint advanced monitoring
Meetup milano #4 log management and anypoint advanced monitoring
Solve Todays Problems with 10 New SharePoint 2010 Features by Cory Peters
Solve Todays Problems with 10 New SharePoint 2010 FeaturesSolve Todays Problems with 10 New SharePoint 2010 Features
Solve Todays Problems with 10 New SharePoint 2010 Features
Cory Peters2.5K views
Moving Data in and out of Reltio - It-s Super EASY.pdf by Alex446314
Moving Data in and out of Reltio - It-s Super EASY.pdfMoving Data in and out of Reltio - It-s Super EASY.pdf
Moving Data in and out of Reltio - It-s Super EASY.pdf
Alex44631459 views
CC Technology Summit 3 Update by Nathan Yergler
CC Technology Summit 3 UpdateCC Technology Summit 3 Update
CC Technology Summit 3 Update
Nathan Yergler1.3K views
Admin Tech Clash: Discussing Best (and Worst) Administration Practices from ... by Christoph Adler
Admin Tech Clash: Discussing Best (and Worst) Administration Practices from  ...Admin Tech Clash: Discussing Best (and Worst) Administration Practices from  ...
Admin Tech Clash: Discussing Best (and Worst) Administration Practices from ...
Christoph Adler243 views
Importance of ‘Centralized Event collection’ and BigData platform for Analysis ! by Piyush Kumar
Importance of ‘Centralized Event collection’ and BigData platform for Analysis !Importance of ‘Centralized Event collection’ and BigData platform for Analysis !
Importance of ‘Centralized Event collection’ and BigData platform for Analysis !
Piyush Kumar8.7K views
Ladies Be Architects - Integration - Multi-Org, Security, JSON, Backup & Restore by gemziebeth
Ladies Be Architects - Integration - Multi-Org, Security, JSON, Backup & RestoreLadies Be Architects - Integration - Multi-Org, Security, JSON, Backup & Restore
Ladies Be Architects - Integration - Multi-Org, Security, JSON, Backup & Restore
gemziebeth828 views
TSPUG: Content Management in SharePoint 2010 by Eli Robillard
TSPUG: Content Management in SharePoint 2010TSPUG: Content Management in SharePoint 2010
TSPUG: Content Management in SharePoint 2010
Eli Robillard552 views
AWS re:Invent 2016: Workshop: AWS S3 Deep-Dive Hands-On Workshop: Deploying a... by Amazon Web Services
AWS re:Invent 2016: Workshop: AWS S3 Deep-Dive Hands-On Workshop: Deploying a...AWS re:Invent 2016: Workshop: AWS S3 Deep-Dive Hands-On Workshop: Deploying a...
AWS re:Invent 2016: Workshop: AWS S3 Deep-Dive Hands-On Workshop: Deploying a...
Amazon Web Services4.1K views
Sharepoint 2010 document managment and workflow by Mahmoud Aljarood
Sharepoint 2010 document managment and workflowSharepoint 2010 document managment and workflow
Sharepoint 2010 document managment and workflow
Mahmoud Aljarood2.1K views

Recently uploaded

Bootstrapping vs Venture Capital.pptx by
Bootstrapping vs Venture Capital.pptxBootstrapping vs Venture Capital.pptx
Bootstrapping vs Venture Capital.pptxZeljko Svedic
15 views17 slides
What is API by
What is APIWhat is API
What is APIartembondar5
12 views15 slides
FIMA 2023 Neo4j & FS - Entity Resolution.pptx by
FIMA 2023 Neo4j & FS - Entity Resolution.pptxFIMA 2023 Neo4j & FS - Entity Resolution.pptx
FIMA 2023 Neo4j & FS - Entity Resolution.pptxNeo4j
17 views26 slides
Top-5-production-devconMunich-2023.pptx by
Top-5-production-devconMunich-2023.pptxTop-5-production-devconMunich-2023.pptx
Top-5-production-devconMunich-2023.pptxTier1 app
9 views40 slides
Ports-and-Adapters Architecture for Embedded HMI by
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMIBurkhard Stubert
29 views19 slides
The Era of Large Language Models.pptx by
The Era of Large Language Models.pptxThe Era of Large Language Models.pptx
The Era of Large Language Models.pptxAbdulVahedShaik
7 views9 slides

Recently uploaded(20)

Bootstrapping vs Venture Capital.pptx by Zeljko Svedic
Bootstrapping vs Venture Capital.pptxBootstrapping vs Venture Capital.pptx
Bootstrapping vs Venture Capital.pptx
Zeljko Svedic15 views
FIMA 2023 Neo4j & FS - Entity Resolution.pptx by Neo4j
FIMA 2023 Neo4j & FS - Entity Resolution.pptxFIMA 2023 Neo4j & FS - Entity Resolution.pptx
FIMA 2023 Neo4j & FS - Entity Resolution.pptx
Neo4j17 views
Top-5-production-devconMunich-2023.pptx by Tier1 app
Top-5-production-devconMunich-2023.pptxTop-5-production-devconMunich-2023.pptx
Top-5-production-devconMunich-2023.pptx
Tier1 app9 views
Ports-and-Adapters Architecture for Embedded HMI by Burkhard Stubert
Ports-and-Adapters Architecture for Embedded HMIPorts-and-Adapters Architecture for Embedded HMI
Ports-and-Adapters Architecture for Embedded HMI
Burkhard Stubert29 views
FOSSLight Community Day 2023-11-30 by Shane Coughlan
FOSSLight Community Day 2023-11-30FOSSLight Community Day 2023-11-30
FOSSLight Community Day 2023-11-30
Shane Coughlan6 views
Airline Booking Software by SharmiMehta
Airline Booking SoftwareAirline Booking Software
Airline Booking Software
SharmiMehta9 views
Gen Apps on Google Cloud PaLM2 and Codey APIs in Action by Márton Kodok
Gen Apps on Google Cloud PaLM2 and Codey APIs in ActionGen Apps on Google Cloud PaLM2 and Codey APIs in Action
Gen Apps on Google Cloud PaLM2 and Codey APIs in Action
Márton Kodok16 views
predicting-m3-devopsconMunich-2023.pptx by Tier1 app
predicting-m3-devopsconMunich-2023.pptxpredicting-m3-devopsconMunich-2023.pptx
predicting-m3-devopsconMunich-2023.pptx
Tier1 app8 views
ADDO_2022_CICID_Tom_Halpin.pdf by TomHalpin9
ADDO_2022_CICID_Tom_Halpin.pdfADDO_2022_CICID_Tom_Halpin.pdf
ADDO_2022_CICID_Tom_Halpin.pdf
TomHalpin95 views
Fleet Management Software in India by Fleetable
Fleet Management Software in India Fleet Management Software in India
Fleet Management Software in India
Fleetable12 views
tecnologia18.docx by nosi6702
tecnologia18.docxtecnologia18.docx
tecnologia18.docx
nosi67025 views
Understanding HTML terminology by artembondar5
Understanding HTML terminologyUnderstanding HTML terminology
Understanding HTML terminology
artembondar57 views
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P... by NimaTorabi2
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
Unlocking the Power of AI in Product Management - A Comprehensive Guide for P...
NimaTorabi216 views
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated... by TomHalpin9
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
TomHalpin96 views

Tracking user activity logs using Loggastic #ApiPlatformCon