grails audit logging
TRANSCRIPT
![Page 1: Grails audit logging](https://reader038.vdocuments.pub/reader038/viewer/2022100723/58f09ebf1a28ab1c5d8b4573/html5/thumbnails/1.jpg)
Grails Audit LoggingBy:
Vishal Sahu
![Page 2: Grails audit logging](https://reader038.vdocuments.pub/reader038/viewer/2022100723/58f09ebf1a28ab1c5d8b4573/html5/thumbnails/2.jpg)
What is Audit Log?An Audit log is a security-relevant chronological record, set of records, and/or destination and source of records that provide documentary evidence of the sequence of activities that have affected at any time a specific operation, procedure, or event.
Industries using Audit Logging:
● TeleCommunications● Information Security● Accounting● Clinical Research● Nursing Research
![Page 3: Grails audit logging](https://reader038.vdocuments.pub/reader038/viewer/2022100723/58f09ebf1a28ab1c5d8b4573/html5/thumbnails/3.jpg)
Grails Audit LoggingThe Audit Logging plugin adds Grails GORM Events based Audit Logging capabilities to a Grails project and it also adds support to domain models for hooking into the Grails GORM events system.
![Page 4: Grails audit logging](https://reader038.vdocuments.pub/reader038/viewer/2022100723/58f09ebf1a28ab1c5d8b4573/html5/thumbnails/4.jpg)
Installationdependencies {
compile 'org.grails.plugins:audit-logging:{version}'
}
Then:
grails compile
![Page 5: Grails audit logging](https://reader038.vdocuments.pub/reader038/viewer/2022100723/58f09ebf1a28ab1c5d8b4573/html5/thumbnails/5.jpg)
Create your Domain Artifact After installing the plugin, you must perform the following command to let the plugin create the audit-logging domain class within your project.
● grails audit-quickstart com.audit AuditTrail
![Page 6: Grails audit logging](https://reader038.vdocuments.pub/reader038/viewer/2022100723/58f09ebf1a28ab1c5d8b4573/html5/thumbnails/6.jpg)
Auditing of domain classEnables audit logging using the introduced domain class AuditLogEvent which will record insert, update, and delete events. Update events will be logged in detail with the property name and the old and new values.
● static auditable = true
![Page 7: Grails audit logging](https://reader038.vdocuments.pub/reader038/viewer/2022100723/58f09ebf1a28ab1c5d8b4573/html5/thumbnails/7.jpg)
Event HandlersYou may use the optional event handlers in your Domain classes. Example:
● onSave● onDelete● onChange
If you want to use Events Handlers only, then you can use:
static auditable = [handlersOnly : true]
![Page 8: Grails audit logging](https://reader038.vdocuments.pub/reader038/viewer/2022100723/58f09ebf1a28ab1c5d8b4573/html5/thumbnails/8.jpg)
Thanks.
Sample Application: https://github.com/NexThoughts/Grails-Audit-Logging-Example-Demo
For any queries you can reach me at:
https://github.com/Vishal-Sahu
https://github.com/Nexthoughts