Even so this thread is old, maybe my answer can help someone:
Cleanup Craft Logs
Basically it's possible via app.php to remove all unnecessary logs such as all the $_GET, $_POST, $_SERVER variables and all the SQL being logged.
The main point you need is to configure in app.php the log component. The entry 'logVars' will get rid of all the $_SERVER values logged (also fixed security issues with password appearing in the logs).
The other interesting configuration is the 'except' array where we excluded a few classes. 'yii\db\Connection::*' for example removes all SQL logs.
return [
'modules' => [
'mymodule' => MyModule::class,
// My modules mapped here
],
'components' => [
'log' => function() {
return Craft::createObject([
'class' => yii\log\Dispatcher::class,
'targets' => [
[
'class' => codemix\streamlog\Target::class,
'url' => 'php://stderr',
'levels' => Craft::$app->getConfig()->general->devMode ?
(yii\log\Logger::LEVEL_ERROR | yii\log\Logger::LEVEL_WARNING | yii\log\Logger::LEVEL_INFO) :
(yii\log\Logger::LEVEL_ERROR | yii\log\Logger::LEVEL_WARNING),
'except' => [
'yii\base\View::renderFile',
'yii\db\Command::*',
'yii\db\Connection::*' // We don't want sql to be logged
],
// don't log global variables like $_SERVER etc periodically in logs.
// See: yii\log\Target::class, collect method usually appends getContextMessage
'logVars' => []
]
]
]);
}
],
'bootstrap' => [
// My module names here
],
];
config/general.php
I'm don't have anydevMode
item in the production array. The linked documentation says the default value is false - so I would assume it should be false.