Skip to content

Commit

Permalink
Audit: Log a command's payload as json
Browse files Browse the repository at this point in the history
$data may be arbitrarily nested.

refs #3535

Signed-off-by: Eric Lippmann <eric.lippmann@icinga.com>
  • Loading branch information
nilmerg authored and lippserd committed Jul 24, 2018
1 parent cfe6c7b commit dbfef34
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
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
Expand Down Expand Up @@ -198,11 +199,7 @@ protected function sendCommand(IcingaApiCommand $command)
);

$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",
Expand Down

0 comments on commit dbfef34

Please sign in to comment.