Yii 1.1: yii-audit-module

Track and display usage information including page requests, database field changes, php errors and yii logs.

Yii Audit Module

Track and display usage information including page requests, database field changes, php errors and yii logs.


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.


Mr PHP Project Stats

Latest Stable Version Build Status



BSD-3-Clause, Copyright © 2013-2014 Mr PHP

Total 16 comments

#19833 report it
cornernote at 2016/04/19 12:06am
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.

#19831 report it
selorm at 2016/04/15 05:52pm
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.

#19390 report it
cornernote at 2015/06/15 10:53am
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

#19382 report it
andrjeuibo at 2015/06/12 09:47am
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?

#19203 report it
cornernote at 2015/04/15 09:41am
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).

#19200 report it
mxd at 2015/04/14 01:06pm
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?

#17331 report it
cornernote at 2014/05/24 08:41pm
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.

#17330 report it
pinkjaimee at 2014/05/24 05:11pm
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?

#16993 report it
cornernote at 2014/04/20 08:33pm
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.

#16992 report it
mxd at 2014/04/20 10:58am
Yii 2 compatible?

Is the audit module or will it be compatible with Yii 2 (beta)?

#16968 report it
cornernote at 2014/04/17 03:33am
no search button

@JbalTero, not sure why you see no search button. Can you create an issue on github with a screenshot?


#16967 report it
JbalTero at 2014/04/17 03:07am

I've got this problem, in audit/log/index, there's no search button. :( How can I solve this?

#16949 report it
cornernote at 2014/04/16 02:50am
access the Module Homepage

Hi @JbalTero,

You just visit yoursite.com/audit

#16948 report it
JbalTero at 2014/04/16 02:44am
Module Homepage Access

How do I access the Module Homepage?

#16209 report it
cornernote at 2014/01/28 09:01pm
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.

#16196 report it
beesho at 2014/01/27 07:56am
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?

Leave a comment

Please to leave your comment.

Create extension