Yii2 Audit ¶
Yii2 Audit is a module that records and displays web/cli requests, database changes, php/js errors and associated data.
Features ¶
Tracks minimal data in the base entry:
user_id
- User ID of the visitor (if any), based onYii::$app->user->id
.ip
- IP Address of the visitor.request_method
- The method used to generate the request, eg:CLI
for console requests andGET
,POST
,DELETE
,PUT
,PATCH
,OPTIONS
orHEAD
for web requests.ajax
- If the page was requested using ajax.route
- The controller and action of the request.duration
- How long the request took to serve.memory_max
- The peak memory usage during the request.created
- The datetime the entry was created.
Tracks additional data using configurable Panels. Each panel is optional, and you can even create your own.
RequestPanel
- Tracks all incoming web and console request data:- URL Information including the route and params.
- PHP SuperGlobals
$_GET
,$_POST
,$_SERVER
,$_FILES
and$_COOKIES
. - Headers from the Request and Response.
AssetPanel
- Asset Bundles loaded for the request.ConfigPanel
- Yii and PHP configuration that was used for the request.DbPanel
- SQL queries.ErrorPanel
- Record all PHP exceptions and errors in the background. Once logged you can configure a cron task to email the errors to a developer so issues can be fixed before they are even reported by a user.JavascriptPanel
- Automatically log JavaScript errors. Errors and warning are logged automatically by includingJSLoggingAsset
asset bundle. The javascript component also provides methods to manually add logging entries.LogPanel
- Yii logs.MailPanel
- Emails that were sent during the requestProfilingPanel
- Application profiling information.TrailPanel
- Database changes that were made during the request using theAuditTrailBehavior
.ExtraDataPanel
- Extra data that you want to store.YourOwnPanel
- Create your own panel to capture any data you want.
Installs as a simple module so it can be added without any hassle.
You can either track specific actions and nothing else or exclude specific routes from logging (wildcard supported).
View your data. The module contains a nice viewer that is automatically made available when you add it to your configuration. It has configurable permissions to limit access to this functionality by IPs, roles or users.
Documentation ¶
Getting started? Try the Installation Guide. You will find further information in the Documentation.
For changes since the last version see the Changelog.
Screenshots ¶
Dashboard ¶
Entry View ¶
Trail Panel ¶
Database Panel ¶
Log Panel ¶
Profiling Panel ¶
Error Panel ¶
Javascript Panel ¶
Credits ¶
Thanks to everyone who has contributed.
License ¶
BSD-3 - Please refer to the license.
error
Hello,
i try to use yii2-audit this extension (http://www.yiiframework.com/extension/yii2-audit/) but i have a problem. with other extension , i have no problem. my error :
in my composer.json, i have added this in the require section by following the instruction :
https://github.com/bedezign/yii2-audit
"bedezign/yii2-audit": "*"
i dont understand. could you help me ?
composer.json
Hallo,
Are you sure it was correctly added in the 'require'-section of your composer.json that it is effectively due to the audit package that the requirements fail? Try to run "composer -v update" to get you more info. Like this it is pretty hard to diagnose.
error
no problem with dependency
Problem 1
- The requested package bedezign/yii2-audit could not be found in any versio n, there may be a typo in the package name.
Potential causes:
see https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion f or more details.
Read https://getcomposer.org/doc/articles/troubleshooting.md for further commo n problems.
stability
Okay think I get it now. You probably have your composer marked for minimum-stability: stable right? I hadn't added a release yet so it wouldn't find that package in stable form. I just added a tag/release. You should be able to install it now.
yii2 audit
ok, it is a problem with stability in the package
thz
other problem
they are a lot of problem with postgres and charset. Not exist BLOG in postgres and if charset is not UTF8, they are no insertion in database
BLOB
It's not a BLOG, it's a BLOB
This simply means a binary field. If you get that set to the equivalent in Postgress (I must have a binary field) then all problems are probably solved. The extension stores binary data (gzipped) in the fields of type BLOB because otherwise your tables would get huge.
error
yes BLOB, sorry.
problem not solved...f the database is not in Utf8 or if you use postgres, extension not run. they are no insertion in the database.
binary field
i test with binary field in postgres but i have an error
Database Exception – yii\db\Exception
Error Info: Array
(
[0] => 22P02 [1] => 7 [2] => ERROR: invalid input syntax for type bytea
)
↵
Caused by: PDOException
SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type bytea
in /var/www/start/_protected/vendor/yiisoft/yii2/db/Command.php at line 825
Compression
I've just drafted a new release (0.1.6) that allows you to toggle compression off completely.
If you can live with bigger records (in the end, space is less of a limiting factor today), you can use that. Just configure the module with
'compressData' => false
. The data fields will then just contain a serialized text instead of binary data.Hope that helps.
problem
now with this version, when i add this section in my main.php
'modules' => [ 'audit' => 'bedezign\yii2\audit\Audit', ],
i have a blank page and the db is empty...
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.