Configuration
Out of the box, you don't have to configure Logit, but if you want to change any of the default settings, you can do so by adding the following array key to your
config.php
file. In this example, you are changing the values of 2 settings.$config['logit'] = [
'rotate' => 30,
'detailedLogs' => true,
];
Logit will perform an
array_replace()
with it's default options (seen below) with what is in your config.php
file, thus if you only need to add to your config.php
file what you want to change.For example, if you choose to set
'Comment' => true
, which means Logit will log every time a comment is created, updated, or deleted. Then you will add this to your config.php file.$config['logit'] = [
'log' => [
'models' => [
'Comment' => true
],
],
];
Default Logit settings.
$config['logit'] = [
'detailedLogs' => false, // Append full JSON object of saved data with the log?
'encodeDetailedLogs' => false,
'frontendLogs' => true, // Log updates in front-end requests? E.g. Channel:Form
'log' => [
'models' => [
'Category' => true,
'CategoryField' => true,
'CategoryGroup' => true,
'Channel' => true,
'ChannelField' => true,
'ChannelEntry' => true,
'ChannelFormSettings' => true,
'ChannelLayout' => true,
'Comment' => false, // Disabled by default, could lead to a lot of logs on a busy site.
'GlobalVariable' => true,
'Site' => true,
'Snippet' => true,
'SpecialtyTemplate' => true,
'Status' => true,
'Template' => true,
'TemplateGroup' => true,
'TemplateRoute' => true,
'Member' => true,
'Role' => true,
'RoleGroup' => true,
'RoleSetting' => true,
'Permission' => true,
],
'postActions' => [
'cp\/(addons\/settings)\/(\S+)' => true,
'cp\/(addons)' => true,
'cp\/(settings)\/(\S+)' => true,
],
'getActions' => [
'cp\/(addons\/install)\/(\S+)' => true,
'cp\/(addons\/remove)\/(\S+)' => true,
],
],
'rotate' => 0, // How often should logs be rotated (in days)?
/*
The default storage locations for log backups is in your site's user/cache/logit folder, however, it is
recommended to use an external storage service such as Amazon S3 to ensure the log files are not accidentally
deleted. Alternatively, you can create a folder outside of your user/cache folder to circumvent EE's cache clearing,
which will delete the contents in the user/cache folder.
*/
'storage' => [
'local' => [
'path' => PATH_CACHE.'logit.log',
],
/*
BoldMinded will not assist in creating or troubleshooting S3 access. You will need to configure your account,
bucket, user, group, and IAM roles and permissions. If you do not configure permissions correctly, Logit will
throw an exception error... this is how you will know something is incorrect with the values below, or with
your user, group, or IAM settings in AWS.
's3' => [
'key' => '',
'secret' => '',
'bucket' => '',
'region' => 'us-east-2' // aka, "US East (Ohio)" https://docs.aws.amazon.com/general/latest/gr/rande.html
'path' => '',
]
*/
],
];
You can optionally send all logs to your server's PHP
error_log
by setting the 'path'
option to 'error_log'
. Your server and PHP must be configured with a valid log path for this to work. Generally this is setup by default on each server.$config['logit'] = [
'storage' => [
'local' => [
'path' => 'error_log'
]
]
];
By default Logit saves all logs, when rotation is enabled, in your
user/cache
folder, but it is recommended to save logs to a different location. Logit only uses the default user/cache
folder because it should be writable as part of ExpressionEngine's default configuration. It is common for 3rd party add-ons to flush the cache, so you want to avoid having your logs accidently deleted by another add-on. For this reason it is highly suggested to choose another local directory path, or use an Amazon S3 bucket. You can manually relocate your log rotation files as needed, such as above the web root. If your public directory is /var/www/html/public
, you may want to save logs to /var/www/html/logs
. To do that, set the storage['local']['path']
value in your config.php
file. The same process may be taken if you decide to add an S3 bucket. As noted in the default configuration array, if
storage['s3']
is provided, then Logit will save all logs to the defined bucket. BoldMinded does not provide support in creating and configuring permissions to S3. If you have issues connecting to the bucket, you will receive an error message and will need to self diagnose and fix the issue.Last modified 2mo ago