add line count
This commit is contained in:
parent
e5c792f90d
commit
22bf8365f1
22
api.php
22
api.php
|
@ -69,13 +69,31 @@
|
|||
|
||||
if(strtoupper($_REQUEST['METODE']) == "LOG")
|
||||
{
|
||||
$logOutput = $dockerClient->getContainerLogs($currentContainer['Id']);
|
||||
$lines = 350;
|
||||
if(isset($_REQUEST['LINES']))
|
||||
{
|
||||
if(trim($_REQUEST['LINES']) != "")
|
||||
{
|
||||
$lines = intval($_REQUEST['LINES']);
|
||||
}
|
||||
}
|
||||
|
||||
$logOutput = $dockerClient->getContainerLogs($currentContainer['Id'], $lines);
|
||||
echo clean($logOutput);
|
||||
}
|
||||
|
||||
if(strtoupper($_REQUEST['METODE']) == "HTMLLOG")
|
||||
{
|
||||
$logOutput = $dockerClient->getContainerLogs($currentContainer['Id']);
|
||||
$lines = 350;
|
||||
if(isset($_REQUEST['LINES']))
|
||||
{
|
||||
if(trim($_REQUEST['LINES']) != "")
|
||||
{
|
||||
$lines = intval($_REQUEST['LINES']);
|
||||
}
|
||||
}
|
||||
|
||||
$logOutput = $dockerClient->getContainerLogs($currentContainer['Id'], $lines);
|
||||
echo html_entity_decode(clean($logOutput))."\n";
|
||||
}
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
return json_decode($jsonRAWData, TRUE);
|
||||
}
|
||||
|
||||
public function getContainerLogs($container){
|
||||
public function getContainerLogs($container, $lines = 350){
|
||||
curl_setopt($this->CurlClient, CURLOPT_POST, FALSE);
|
||||
curl_setopt($this->CurlClient, CURLOPT_URL, "http:/v1.24/containers/".$container."/logs?stdout=1&tail=350");
|
||||
curl_setopt($this->CurlClient, CURLOPT_URL, "http:/v1.24/containers/".$container."/logs?stdout=1&tail=".$lines);
|
||||
|
||||
$rawOutput = curl_exec($this->CurlClient);
|
||||
return $rawOutput;
|
||||
|
|
Loading…
Reference in New Issue