Yii Audit Module ¶
Track and display usage information including page requests, database field changes, php errors and yii logs.
Features ¶
Visitor Request Tracking ¶
- Track site activity including everything you need to know about the request.
- The error handler will automatically create an AuditRequest record for each visitor hit.
- When the application ends it will update the AuditRequest with memory and time information.
Tracks the following information:
- Links - Requested URL, referring URL, redirecting to URL (read from the headers at the end of the application)
- User - Visitors IP Address and logged in user's ID
- Superglobals - (
$_GET
/$_POST
/$_SESSION
/$_FILES
/$_COOKIE
), the arrays are serialized then compressed using gzip - Timers - Start and end times of the application
- Memory - Memory usage and peak memory usage
Model Field Tracking ¶
- Tracks the old and new values each time your model is saved.
- Behavior can easily be attached to any model you want to track field changes.
- Each field change is related to an AuditRequest so you can see the entire state of the visitors action.
- Performs multiple inserts in a single query with
CDbCommandBuilder::createMultipleInsertCommand()
. - Provides views that can be rendered into your application to show changed fields for your model.
Error Tracking ¶
- Full error stack dump is saved, even in live mode.
- Catches all errors, including fatal errors.
- View all the collected data from the module interface.
- Each error is related to an AuditRequest so you can see the entire state of the visitors action.
Log Tracking ¶
- Save logs to your database for easy real-time debugging or for checking on historical logs.
- Each log is related to an AuditRequest so you can see the entire state of the visitors action.
Resources ¶
Support ¶
- Does this README need improvement? Go ahead and suggest a change.
- Found a bug, or need help using this project? Check the open issues or create an issue.
License ¶
BSD-3-Clause, Copyright © 2013-2014 Mr PHP
Maximum function nesting level reached
I was trying to manually install this extension, but I always got this error:
"Fatal error: Maximum function nesting level of '100' reached, aborting! in C:*****\protected\modules\audit\components\AuditActiveRecord.php on line 386"
PS: No matter how I increase 'xdebug.max_nesting_level' it still aborts after reaching the increased level.
I have checked the configuration very well, as well as the module path but couldn't get it to work.
Any suggestions?
Thanks for the feedback.
Hey @beesho,
AuditActiveRecord.php does not have a line 386.
Can you please post bug-reports in the issue tracker, they are a lot easier to manager there than in these comments.
Module Homepage Access
How do I access the Module Homepage?
access the Module Homepage
Hi @JbalTero,
You just visit yoursite.com/audit
Nice.
I've got this problem, in audit/log/index, there's no search button. :( How can I solve this?
no search button
@JbalTero, not sure why you see no search button. Can you create an issue on github with a screenshot?
https://github.com/cornernote/yii-audit-module/issues/new
Yii 2 compatible?
Is the audit module or will it be compatible with Yii 2 (beta)?
Yii 2 compatible
Hi @mxd,
It's not currently compatible with Yii2, but we have plans to do so in the future, however there is no ETA on when we may be able to do it.
htmlspecialchars(): Invalid multibyte sequence in argument
I'm getting this error. htmlspecialchars(): Invalid multibyte sequence in argument. I do have 'charset' => 'utf8' in my db.
How does this handle guest user since there is no user_id?
htmlspecialchars(): Invalid multibyte sequence in argument
Hi @pinkjaimee,
Please report your issue at https://github.com/cornernote/yii-audit-module/issues/new so that I can address it formally.
Guest and console scripts are logged as user_id=0.
Yii2 update?
It's been almost a year since my last question... ;)
Is there any new info about the possible Yii2 version of this audit-module?
I have now looked at yii2
I have looked at yii2, very nice and shiny... some very cool features.
The internal debugging is a bit different, so much of this module will need to be refactored.
I don't have time for such a project until I start a project with Yii2 and have a practical need for it.
If you would like to have a go at converting it i'd be happy to explain the code and assist where I can. Shoot me an email if you're interested (email on github profile).
Got an error
Undefined property: CWebApplication::$request in: project/protected/modules/audit/AuditModule.php on line 277 Fatal error: Call to a member function getPathInfo() on a non-object in /path/to/yii/web/CUrlManager.php on line 364
What could be causing this error?
re: Got an error
@andrjeuibo, not sure, is this in a web or cli app?
Can you please open a new issue here:
https://github.com/cornernote/yii-audit-module/issues/new
Also, ensure you have the latest version from github here:
https://github.com/cornernote/yii-audit-module/releases
causing performance problems in production
I used this module for sometime in production (about 6 months) but suddenly its beginning to cause performance issues.
The audit_request table has grown to more than 7m rows and the highest table rows in my application is about 800,000 rows.
Usually, during peak hours with lots of concurrent requests, the application would crash. Thus, it would report some classes or files cannot be found, cannot redeclare class errors, AuditRequest.created(or other columns) not found until i restart the server before it goes to normal.
I set trackAllRequest to false and it would report db transaction is not active etc.
I'm currently investigating the code for improvement but for the meantime, has anybody encountered such errors before and how were you able to overcome them.
causing performance problems in production
Hey @selorm,
I use pt-archiver to move the old data to a different mysql instance. This prevents the main database getting too full, but still gives me some access to the old data if needed. You could also just delete the old rows.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.