Mailwatch page message information Empty

Report bugs and workarounds
Post Reply
wilbourne
Posts: 52
Joined: 22 Sep 2016 09:04

Mailwatch page message information Empty

Post by wilbourne »

Hello All,

Since the last update EFA-3.0.2.3 when i log into mailwatch and i want to see information about a message (blue button) I Have a blank page . Before EFA-3.0.1.9 I could see the ip adresse of server and other value and now i cannot.

So if I restart the server after the reboot I can see all information for a moment and if I try to see 1 day after. I can't and I need to restart again the server. :cry:

How i can resolve this error?
User avatar
pdwalker
Posts: 1553
Joined: 18 Mar 2015 09:16

Re: Mailwatch page message information Empty

Post by pdwalker »

There's not enough information for me to even attempt to diagnose your problem.

How about some screen shots demonstrating the problem?
wilbourne
Posts: 52
Joined: 22 Sep 2016 09:04

Re: Mailwatch page message information Empty

Post by wilbourne »

Thank you for you reply.

Here is some screenshot :

for example if I click on the I button (see screenshot below)
2017-06-07 17_47_16-MailWatch pour MailScanner - Messages récents.png
2017-06-07 17_47_16-MailWatch pour MailScanner - Messages récents.png (3.22 KiB) Viewed 49891 times


I obtain this page :
2017-06-07 17_50_04-MailWatch pour MailScanner - Détail du message 9C6161011DF.A6BD2.png
2017-06-07 17_50_04-MailWatch pour MailScanner - Détail du message 9C6161011DF.A6BD2.png (3.32 KiB) Viewed 49890 times
User avatar
shawniverson
Posts: 3644
Joined: 13 Jan 2014 23:30
Location: Indianapolis, Indiana USA
Contact:

Re: Mailwatch page message information Empty

Post by shawniverson »

When you click the "i", watch the /var/log/httpd logs.

See anything interesting when you do this?
wilbourne
Posts: 52
Joined: 22 Sep 2016 09:04

Re: Mailwatch page message information Empty

Post by wilbourne »

in /var/log/httpd/error.log and I have this :

PHP Fatal error: Uncaught exception 'mysqli_sql_exception' with message 'Incorrect key file for table 'audit_log'; try to repair it' in /var/www/html/mailscanner/functions.php:1003\nStack trace:\n#0 /var/www/html/mailscanner/functions.php(1003): mysqli->query('INSERT INTO aud...')\n#1 /var/www/html/mailscanner/functions.php(3770): dbquery('INSERT INTO aud...')\n#2 /var/www/html/mailscanner/detail.php(125): audit_log('Visionnage de l...')\n#3 {main}\n thrown in /var/www/html/mailscanner/functions.php on line 1003, referer: http://ip_address/mailscanner/status.php
User avatar
shawniverson
Posts: 3644
Joined: 13 Jan 2014 23:30
Location: Indianapolis, Indiana USA
Contact:

Re: Mailwatch page message information Empty

Post by shawniverson »

It appears to be having trouble with the audit table. Have you run a database repair?
wilbourne
Posts: 52
Joined: 22 Sep 2016 09:04

Re: Mailwatch page message information Empty

Post by wilbourne »

here is the result :

efa.tokens OK
mailscanner.audit_log
Warning : InnoDB: Index "PRIMARY" is marked as corrupted
error : Corrupt
mailscanner.autorelease OK
mailscanner.blacklist OK
mailscanner.inq OK
mailscanner.maillog OK
mailscanner.mcp_rules OK
mailscanner.mtalog OK
mailscanner.mtalog_ids OK
mailscanner.outq OK
mailscanner.sa_rules OK
mailscanner.saved_filters OK
mailscanner.user_filters OK
mailscanner.users OK
mailscanner.whitelist OK
mysql.column_stats OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.index_stats OK
mysql.innodb_index_stats OK
mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.roles_mapping OK
mysql.servers OK
mysql.table_stats OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
sa_bayes.awl OK
sa_bayes.bayes_expire OK
sa_bayes.bayes_global_vars OK
sa_bayes.bayes_seen OK
sa_bayes.bayes_token OK
sa_bayes.bayes_vars OK
sa_bayes.txrep OK
sqlgrey.config OK
sqlgrey.connect OK
sqlgrey.domain_awl OK
sqlgrey.from_awl OK
sqlgrey.optin_domain OK
sqlgrey.optin_email OK
sqlgrey.optout_domain OK
sqlgrey.optout_email OK


How I can repair innodb?
wilbourne
Posts: 52
Joined: 22 Sep 2016 09:04

Re: Mailwatch page message information Empty

Post by wilbourne »

It's really weird because when I reboot the server everything is work for a while.
User avatar
shawniverson
Posts: 3644
Joined: 13 Jan 2014 23:30
Location: Indianapolis, Indiana USA
Contact:

Re: Mailwatch page message information Empty

Post by shawniverson »

Depending on the importance of the audit table. It may behoove you to rebuild this table and dump the data from it. If you are willing, I could post a SQL script that can do this for you.
wilbourne
Posts: 52
Joined: 22 Sep 2016 09:04

Re: Mailwatch page message information Empty

Post by wilbourne »

yes off course, if you have this It's perfect. thank you for your help
User avatar
pdwalker
Posts: 1553
Joined: 18 Mar 2015 09:16

Re: Mailwatch page message information Empty

Post by pdwalker »

Wilbourne, do you run EFA in a virtual machine, or directly on hardware?
wilbourne
Posts: 52
Joined: 22 Sep 2016 09:04

Re: Mailwatch page message information Empty

Post by wilbourne »

Onto an virtual machine
User avatar
shawniverson
Posts: 3644
Joined: 13 Jan 2014 23:30
Location: Indianapolis, Indiana USA
Contact:

Re: Mailwatch page message information Empty

Post by shawniverson »

Place this code into a rebuiltaudit.php, chmod +x, and run as root:

Code: Select all

#!/usr/bin/php -q
<?php
if (PHP_SAPI !== 'cli') {
    header('Content-type: text/plain');
}

// Edit if you changed webapp directory from default and not using command line argument to define it
$pathToFunctions = '/var/www/html/mailscanner/functions.php';
//$pathToFunctions = __DIR__ . '/mailscanner/functions.php';

if (!@is_file($pathToFunctions)) {
    die('Error: Cannot find functions.php file in "' . $pathToFunctions . '": edit ' . __FILE__ . ' and set the right path on line ' . (__LINE__ - 3) . PHP_EOL);
}

require_once $pathToFunctions;

$link = dbconn();

/**
 * @param string $sql
 */
function executeQuery($sql)
{
    global $link;
    if ($link->query($sql)) {
        echo color(' OK', 'green') . PHP_EOL;
    } else {
        echo color(' ERROR', 'red') . PHP_EOL;
        die('Database error: ' . $link->error . " - SQL = '$sql'" . PHP_EOL);
    }
}

/**
 * @param string $table
 * @return bool|mysqli_result
 */
function check_table_exists($table)
{
    global $link;
    $sql = 'SHOW TABLES LIKE "' . $table . '"';

    return ($link->query($sql)->num_rows > 0);
}


/**
 * @param string $string
 * @param string $color
 * @return string
 */
function color($string, $color = '')
{
    $after = "\033[0m";
    switch ($color) {
        case 'green':
            $before = "\033[1;32m";
            break;
        case 'lightgreen':
            $before = "\033[0;32m";
            break;
        case 'yellow':
            $before = "\033[1;33;40m";
            break;
        case 'red':
            $before = "\033[0;31m";
            break;
        default:
            $before = '';
            $after = '';
            break;
    }

    return $before . $string . $after;
}

/**
 * @param string $input
 * @return string
 */
function pad($input)
{
    return str_pad($input, 70, '.', STR_PAD_RIGHT);
}


$errors = false;

echo pad('Testing connectivity to the database ');

if ($link) {
    echo color(' OK', 'green') . PHP_EOL;

    echo pad(' - Drop `audit_log` table');
    $sql = 'DROP TABLE IF EXISTS `audit_log`';
    executeQuery($sql);

    echo pad(' - Rebuild audit_log table on `' . DB_NAME . '` database');
    $sql = 'CREATE TABLE IF NOT EXISTS `audit_log` (
        `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
        `user` VARCHAR(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT "",
        `ip_address` VARCHAR(15) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT "",
        `action` MEDIUMTEXT COLLATE utf8mb4_unicode_ci NOT NULL,
        `id` BIGINT(20) unsigned NOT NULL AUTO_INCREMENT,
        PRIMARY KEY (`id`)
        ) ENGINE=InnoDB AUTO_INCREMENT=370 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci';
    executeQuery($sql);
    echo pad(' - Rebuilt audit_log table');
}

wilbourne
Posts: 52
Joined: 22 Sep 2016 09:04

Re: Mailwatch page message information Empty

Post by wilbourne »

Thank you, it works :clap:
Post Reply