Tracking user activity logs using Loggastic
summary
Library that logs user and system activity to Elasticsearch from Symfony apps, integrated with API Platform and using Doctrine listeners + Symfony Messenger to make logging asynchronous. It creates two indexes per entity (current data tracker and activity_log), uses serialization groups and a Loggable attribute to choose tracked fields, supports custom actions, LoggableChildInterface and LogIdentifierExtractor for readable identifiers, and provides API and Twig readers. Commands include composer require locastic/loggastic and bin/console locastic:activity-logs:create-loggable-indexes. On one project it handles 1.5 million activity logs with API responses under 200 ms.
AI-written summary · about
chapters (23)
- 0:00Intro
- 4:05Activity log
- 5:02Loggable behavior
- 7:36Loggastic
- 8:36Flow
- 9:16Indexes
- 10:19Installation
- 10:38Entity loggable
- 12:01Create elastic indexes
- 12:56populate current data trackers
- 14:23edit activity log
- 15:27delete activity log
- 15:48display activity logs in API platform
- 18:25display activity logs in Twig
- 20:02implementation summary
- 20:28configuration reference
- 22:03customize log to data
- 25:38changing the default loga listener
- 27:07customactionname
- 28:42optimize
- 30:49pros cons
- 32:03real projects
- 32:45future plans








