Skip to content

Commit 78d963e

Browse files
committed
added web-log viewer
1 parent f789b7f commit 78d963e

File tree

12 files changed

+302
-1
lines changed

12 files changed

+302
-1
lines changed

bin/v-list-web-domain-accesslog

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
# info: list web domain access log
3+
# options: USER DOMAIN [LINES]
4+
#
5+
# The function of obtaining raw access web domain logs.
6+
7+
8+
#----------------------------------------------------------#
9+
# Variable&Function #
10+
#----------------------------------------------------------#
11+
12+
# Argument defenition
13+
user=$1
14+
domain=$2
15+
lines=${3-30}
16+
17+
# Includes
18+
source $VESTA/conf/vesta.conf
19+
source $VESTA/func/main.sh
20+
21+
22+
23+
#----------------------------------------------------------#
24+
# Verifications #
25+
#----------------------------------------------------------#
26+
27+
check_args '2' "$#" 'USER DOMAIN [FORMAT]'
28+
is_object_valid 'user' 'USER' "$user"
29+
is_object_valid 'web' 'DOMAIN' "$domain"
30+
31+
#----------------------------------------------------------#
32+
# Action #
33+
#----------------------------------------------------------#
34+
35+
# Check number of output lines
36+
if [ "$lines" -gt '3000' ]; then
37+
read_cmd="cat"
38+
else
39+
read_cmd="tail -n $lines"
40+
fi
41+
42+
$read_cmd /var/log/$WEB_SYSTEM/domains/$domain.log
43+
44+
45+
#----------------------------------------------------------#
46+
# Vesta #
47+
#----------------------------------------------------------#
48+
49+
exit

bin/v-list-web-domain-errorlog

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/bash
2+
# info: list web domain error log
3+
# options: USER DOMAIN [LINES]
4+
#
5+
# The function of obtaining raw error web domain logs.
6+
7+
8+
#----------------------------------------------------------#
9+
# Variable&Function #
10+
#----------------------------------------------------------#
11+
12+
# Argument defenition
13+
user=$1
14+
domain=$2
15+
lines=${3-30}
16+
17+
# Includes
18+
source $VESTA/conf/vesta.conf
19+
source $VESTA/func/main.sh
20+
21+
22+
23+
#----------------------------------------------------------#
24+
# Verifications #
25+
#----------------------------------------------------------#
26+
27+
check_args '2' "$#" 'USER DOMAIN [FORMAT]'
28+
is_object_valid 'user' 'USER' "$user"
29+
is_object_valid 'web' 'DOMAIN' "$domain"
30+
31+
#----------------------------------------------------------#
32+
# Action #
33+
#----------------------------------------------------------#
34+
35+
# Check number of output lines
36+
if [ "$lines" -gt '3000' ]; then
37+
read_cmd="cat"
38+
else
39+
read_cmd="tail -n $lines"
40+
fi
41+
42+
$read_cmd /var/log/$WEB_SYSTEM/domains/$domain.error.log
43+
44+
45+
#----------------------------------------------------------#
46+
# Vesta #
47+
#----------------------------------------------------------#
48+
49+
exit

web/download/web-log/index.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
// Init
3+
error_reporting(NULL);
4+
session_start();
5+
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
6+
$v_domain = $_GET['domain'];
7+
$v_domain = escapeshellarg($_GET['domain']);
8+
if ($_GET['type'] == 'access') $type = 'access';
9+
if ($_GET['type'] == 'error') $type = 'error';
10+
11+
header("Cache-Control: public");
12+
header("Content-Description: File Transfer");
13+
header("Content-Disposition: attachment; filename=".$_GET['domain'].".".$type."-log.txt");
14+
header("Content-Type: application/octet-stream; ");
15+
header("Content-Transfer-Encoding: binary");
16+
17+
$v_domain = escapeshellarg($_GET['domain']);
18+
if ($_GET['type'] == 'access') $type = 'access';
19+
if ($_GET['type'] == 'error') $type = 'error';
20+
21+
exec (VESTA_CMD."v-list-web-domain-".$type."log $user ".$v_domain." 5000", $output, $return_var);
22+
if ($return_var == 0 ) {
23+
foreach($output as $file) {
24+
echo $file . "\n";
25+
}
26+
}
27+
28+
?>

web/inc/i18n/en.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
'logout' => 'logout',
6666
'edit' => 'edit',
6767
'open webstats' => 'open webstats',
68+
'view logs' => 'view logs',
6869
'list records' => 'list %s records',
6970
'add record' => 'add record',
7071
'list accounts' => 'list %s accounts',
@@ -308,6 +309,8 @@
308309
'stats password' => 'stats password',
309310
'ftp user password' => 'ftp user password',
310311
'ftp user' => 'ftp user',
312+
'Download AccessLog' => 'Download AccessLog',
313+
'Download ErrorLog' => 'Download ErrorLog',
311314

312315
'1 account' => '1 account',
313316
'%s accounts' => '%s accounts',

web/inc/i18n/es.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
'logout' => 'salir',
6565
'edit' => 'editar',
6666
'open webstats' => 'abrir webstats',
67+
'view logs' => 'ver los logs',
6768
'list records' => 'listar los %s registros',
6869
'add record' => 'añadir registro',
6970
'list accounts' => 'listar %s cuentas',
@@ -307,6 +308,8 @@
307308
'stats password' => 'contraseña estadísticas',
308309
'ftp user password' => 'contraseña usuario ftp',
309310
'ftp user' => 'usuario ftp',
311+
'Download AccessLog' => 'Descargar AccessLog',
312+
'Download ErrorLog' => 'Descargar ErrorLog',
310313

311314
'1 account' => '1 cuenta',
312315
'%s accounts' => '%s cuentas',

web/inc/i18n/ro.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
'logout' => 'logout',
6767
'edit' => 'edita',
6868
'open webstats' => 'deschide raportul de analiză',
69+
'view logs' => 'vizualiza loguri',
6970
'list records' => 'arată inregistrarile: %s',
7071
'add record' => 'adaugă înregistrare',
7172
'list accounts' => 'arata conturi: %s',
@@ -309,6 +310,8 @@
309310
'stats password' => 'parola de utilizator statistici',
310311
'ftp user password' => 'parola de FTP',
311312
'ftp user' => 'cont FTP',
313+
'Download AccessLog' => 'Descarcă AccessLog',
314+
'Download ErrorLog' => 'Descarcă ErrorLog',
312315

313316
'1 account' => '1 utilizator',
314317
'%s accounts' => '%s utilizatori',

web/inc/i18n/ru.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
'logout' => 'выйти',
6767
'edit' => 'редактировать',
6868
'open webstats' => 'открыть отчет веб-аналитики',
69+
'view logs' => 'просмотреть логи',
6970
'list records' => 'показать записи: %s',
7071
'add record' => 'добавить запись',
7172
'list accounts' => 'показать аккаунты: %s',
@@ -309,6 +310,8 @@
309310
'stats password' => 'пароль пользователя статистики',
310311
'ftp user password' => 'пароль для доступа к FTP',
311312
'ftp user' => 'пользователь FTP',
313+
'Download AccessLog' => 'Скачать AccessLog',
314+
'Download ErrorLog' => 'Скачать ErrorLog',
312315

313316
'1 account' => ' пользователей на странице: 1',
314317
'%s accounts' => 'пользователей на странице: %s',

web/inc/i18n/ua.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
'logout' => 'вийти',
6767
'edit' => 'редагувати',
6868
'open webstats' => 'відкрити звіт веб-аналітики',
69+
'view logs' => 'переглянути логи',
6970
'list records' => 'показати записи: %s',
7071
'add record' => 'додати запис',
7172
'list accounts' => 'показати акаунти: %s',
@@ -309,7 +310,9 @@
309310
'stats password' => 'пароль користувача статистики',
310311
'ftp user password' => 'пароль для доступу до FTP',
311312
'ftp user' => 'користувач FTP',
312-
313+
'Download AccessLog' => 'Завантажити AccessLog',
314+
'Download ErrorLog' => 'Завантажити ErrorLog',
315+
313316
'1 account' => ' користувач на сторінці: 1',
314317
'%s accounts' => 'користувачів на сторінці: %s',
315318
'1 domain' => 'домен на сторінці: 1',

web/list/web-log/index.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
// Init
3+
error_reporting(NULL);
4+
session_start();
5+
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
6+
7+
// Header
8+
include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/list_weblog.html');
9+
10+
$v_domain = escapeshellarg($_GET['domain']);
11+
if ($_GET['type'] == 'access') $type = 'access';
12+
if ($_GET['type'] == 'error') $type = 'error';
13+
14+
exec (VESTA_CMD."v-list-web-domain-".$type."log $user ".$v_domain, $output, $return_var);
15+
16+
if ($return_var == 0 ) {
17+
foreach($output as $file) {
18+
echo $file . "\n";
19+
}
20+
}

web/templates/admin/list_web.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,13 @@
109109
<?php print __('edit');?>
110110
</span>
111111
</a>
112+
<a href="/list/web-log/?domain=<?php echo $key ?>&type=access" target="_blank" class="data-controls">
113+
<span>
114+
<img src="/images/new_window.png" width="8px" height="8px">
115+
<?php print __('view logs');?>
116+
</span>
117+
</a>
118+
112119
<?php
113120
if (!empty($data[$key]['STATS'])) {
114121
?>

0 commit comments

Comments
 (0)