I’am integrating hestia’s functionality into my own system and now came to step where I should list access and error logs to the end-users.
How it is done in Hestia interface? I mean, appending new lines after refresh of url. For example:
https://server.domain.tld:1166/list/web-log/?domain=domain2.tld&type=access
I can’t find any javascript example which handles this, so it should be PHP…
sahsanu
2
PHP file used by Hestia is this:
/usr/local/hestia/web/list/web-log/index.php
And basically it executes commands v-list-web-domain-accesslog
and v-list-web-domain-errorlog
.
1 Like
shryus
3
But when he calls v-list-web-domain-accesslog he gets the number 2
sahsanu
4
Sorry but don’t know what you mean.
eris
5
v-list-web-domain-accesslog user domain 200 json
And you will get a lift of the last 200 lines of the access logs
shryus
6
I have this error
string(34) "Error: invalid ttl format :: json "
sahsanu
7
Command format is:
v-list-web-domain-accesslog USER DOMAIN [LINES] [FORMAT]
So you can’t use
v-list-web-domain-accesslog USER DOMAIN json
You must specify the number of lines (example with 200):
v-list-web-domain-accesslog USER DOMAIN 200 json
shryus
8
This is what my reference looks like in PHP
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://' . $hst_hostname . ':' . $hst_port . '/api/');
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query(array(
'user' => $user_name_admin_hestiacp,
'password' => $user_password_admin_hestiacp
'returncode' => 'no',
'cmd' => 'v-list-web-domain-accesslog',
'arg1' => $user_host,
'arg2' => $domens,
'arg3' => 'json'
)));
$answer = curl_exec($curl);
// Parse JSON output
return json_decode($answer, true);
And it’s not written anywhere in the documentation
shryus
10
I disabled JSON, and it works.
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://' . $hst_hostname . ':' . $hst_port . '/api/');
curl_setopt($curl, CURLOPT_RETURNTRANSFER,true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query(array(
'user' => $user_name_admin_hestiacp,
'password' => $user_password_admin_hestiacp
'returncode' => 'no',
'cmd' => 'v-list-web-domain-accesslog',
'arg1' => $user_host,
'arg2' => $domens,
//'arg3' => 'json'
)));
$answer = curl_exec($curl);
// Parse JSON output
echo $answer;
sahsanu
11
Yes, because by default it uses 70 lines but if you want to use the format you must specify the number of lines.
eris
12
Leaving it empty as in ‘’ should work aswell…
sahsanu
13
It doesn’t work because it is defined as ttl=${3-70}
instead of ttl=${3:-70}
so an empty argument doesn’t work in this command 
1 Like
shryus
14
I don’t want it to be like in the hestiacp panel
sahsanu
15
I don’t know what you want nor what you are trying to do, I’m only explaining what are the arguments the command needs.