diff --git a/data/web/admin.php b/data/web/admin.php
index 2d800622..384e20da 100644
--- a/data/web/admin.php
+++ b/data/web/admin.php
@@ -328,6 +328,21 @@ $tfa_data = get_tfa();
+
diff --git a/data/web/inc/functions.inc.php b/data/web/inc/functions.inc.php
index 0c0f69c3..a1a6d935 100644
--- a/data/web/inc/functions.inc.php
+++ b/data/web/inc/functions.inc.php
@@ -5228,6 +5228,14 @@ function get_logs($container, $lines = 100) {
return $data_array;
}
}
+ if ($container == "sogo-mailcow") {
+ if ($data = $redis->lRange('SOGO_LOG', 1, $lines)) {
+ foreach ($data as $json_line) {
+ $data_array[] = json_decode($json_line, true);
+ }
+ return $data_array;
+ }
+ }
return false;
}
?>
diff --git a/data/web/js/admin.js b/data/web/js/admin.js
index b0fdbbde..96c189be 100644
--- a/data/web/js/admin.js
+++ b/data/web/js/admin.js
@@ -79,6 +79,10 @@ jQuery(function($){
e.preventDefault();
draw_dovecot_logs();
});
+ $("#refresh_sogo_log").on('click', function(e) {
+ e.preventDefault();
+ draw_sogo_logs();
+ });
function draw_postfix_logs() {
ft_postfix_logs = FooTable.init('#postfix_log', {
"columns": [
@@ -126,6 +130,53 @@ jQuery(function($){
}
});
}
+ function draw_sogo_logs() {
+ ft_sogo_logs = FooTable.init('#sogo_log', {
+ "columns": [
+ {"name":"time","formatter":function unix_time_format(tm) { var date = new Date(tm ? tm * 1000 : 0); return date.toLocaleString();},"title":lang.time,"style":{"width":"170px"}},
+ {"name":"priority","title":lang.priority,"style":{"width":"80px"}},
+ {"name":"message","title":lang.message},
+ ],
+ "rows": $.ajax({
+ dataType: 'json',
+ url: '/api/v1/get/logs/sogo/1000',
+ jsonp: false,
+ error: function () {
+ console.log('Cannot draw sogo log table');
+ },
+ success: function (data) {
+ $.each(data, function (i, item) {
+ var danger_class = ["emerg", "alert", "crit"];
+ var warning_class = ["warning"];
+ var info_class = ["notice", "info", "debug"];
+ if (jQuery.inArray(item.priority, danger_class) !== -1) {
+ item.priority = '' + item.priority + '';
+ }
+ else if (jQuery.inArray(item.priority, warning_class) !== -1) {
+ item.priority = '' + item.priority + '';
+ }
+ else if (jQuery.inArray(item.priority, info_class) !== -1) {
+ item.priority = '' + item.priority + '';
+ }
+ });
+ }
+ }),
+ "empty": lang.empty,
+ "paging": {
+ "enabled": true,
+ "limit": 5,
+ "size": pagination_size
+ },
+ "filtering": {
+ "enabled": true,
+ "position": "left",
+ "placeholder": lang.filter_table
+ },
+ "sorting": {
+ "enabled": true
+ }
+ });
+ }
function draw_dovecot_logs() {
ft_postfix_logs = FooTable.init('#dovecot_log', {
"columns": [
@@ -214,7 +265,6 @@ jQuery(function($){
}
});
}
-
function draw_fwd_hosts() {
ft_domainadmins = FooTable.init('#forwardinghoststable', {
"columns": [
@@ -260,6 +310,7 @@ jQuery(function($){
draw_postfix_logs();
draw_dovecot_logs();
+ draw_sogo_logs();
draw_domain_admins();
draw_fwd_hosts();
});
\ No newline at end of file
diff --git a/data/web/json_api.php b/data/web/json_api.php
index 99dd1f16..0301659a 100644
--- a/data/web/json_api.php
+++ b/data/web/json_api.php
@@ -80,7 +80,6 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
echo '{}';
}
break;
-
case "postfix":
if (isset($extra) && !empty($extra)) {
$extra = intval($extra);
@@ -96,6 +95,21 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
echo '{}';
}
break;
+ case "sogo":
+ if (isset($extra) && !empty($extra)) {
+ $extra = intval($extra);
+ $logs = get_logs('sogo-mailcow', $extra);
+ }
+ else {
+ $logs = get_logs('sogo-mailcow', -1);
+ }
+ if (isset($logs) && !empty($logs)) {
+ echo json_encode($logs, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
+ }
+ else {
+ echo '{}';
+ }
+ break;
}
break;
case "mailbox":
diff --git a/data/web/lang/lang.de.php b/data/web/lang/lang.de.php
index d1a8300d..a182ff4a 100644
--- a/data/web/lang/lang.de.php
+++ b/data/web/lang/lang.de.php
@@ -33,8 +33,8 @@ $lang['danger']['alias_empty'] = 'Alias-Adresse darf nicht leer sein';
$lang['danger']['goto_empty'] = 'Ziel-Adresse darf nicht leer sein';
$lang['danger']['policy_list_from_exists'] = 'Ein Eintrag mit diesem Wert existiert bereits';
$lang['danger']['policy_list_from_invalid'] = 'Eintrag hat ungültiges Format';
-$lang['danger']['alias_invalid'] = 'Alias-Adrese ist ungültig';
-$lang['danger']['goto_invalid'] = 'Ziel-Adrese ist ungültig';
+$lang['danger']['alias_invalid'] = 'Alias-Adresse ist ungültig';
+$lang['danger']['goto_invalid'] = 'Ziel-Adresse ist ungültig';
$lang['danger']['last_key'] = 'Letzter Key kann nicht gelöscht werden';
$lang['danger']['alias_domain_invalid'] = 'Alias-Domain ist ungültig';
$lang['danger']['target_domain_invalid'] = 'Ziel-Domain ist ungültig';