Merge pull request #3537 from Icinga/fix/array-to-str-conversion-when-sending-commands-3535

Audit: Log a command's payload as json
This commit is contained in:
Eric Lippmann 2018-08-02 12:39:34 +02:00 committed by GitHub
commit 27c6c06f75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 5 deletions

View File

@ -12,6 +12,7 @@ use Icinga\Module\Monitoring\Command\Renderer\IcingaApiCommandRenderer;
use Icinga\Module\Monitoring\Exception\CommandTransportException;
use Icinga\Module\Monitoring\Exception\CurlException;
use Icinga\Module\Monitoring\Web\Rest\RestRequest;
use Icinga\Util\Json;
/**
* Command transport over Icinga 2's REST API
@ -198,11 +199,7 @@ class ApiCommandTransport implements CommandTransportInterface
);
$data = $command->getData();
$payload = [];
foreach ($data as $key => $value) {
$payload[] = "$key=$value";
}
$payload = implode(', ', $payload);
$payload = Json::encode($data);
AuditHook::logActivity(
'monitoring/command',
"Issued command {$command->getEndpoint()} with the following payload: $payload",