rsyslog / loganalyzer

Adiscon LogAnalyzer, a web frontend to log data from the same folks the created rsyslog
Other
76 stars 39 forks source link

PHP8 Support #75

Closed alorbach closed 2 years ago

alorbach commented 3 years ago

Check loganalyzer for php8 support and fix compatibility issues.

recrunchi commented 3 years ago

Hi. I just reinstalled my old server to upgrade it, and now i see that loganalyzer does not support php 8. Anybody knows if there is any advance on this? Thanks!

Eraserstp commented 2 years ago

I just commented out the content of the RemoveMagicQuotes() function in the /var/www/loganalyzer/include/functions_common.php file. It uses the get_magic_quotes_gpc() function, which was removed in PHP 8, since 7.4 it always returns false, so it is okay to just comment it.

recrunchi commented 2 years ago

I just commented out the content of the RemoveMagicQuotes() function in the /var/www/loganalyzer/include/functions_common.php file. It uses the get_magic_quotes_gpc() function, which was removed in PHP 8, since 7.4 it always returns false, so it is okay to just comment it.

Eraserstp, your solution works to me! Now i can use loganalyzer with php8. Many thanks!

kishchan commented 2 years ago

i commented the RemoveMagicQuotes() Function but got a new error. any help would be appreciated.

Fatal error: Uncaught Error: Call to a member function LogStreamFactory() on null in /var/www/html/loganalyzer/index.php:228 Stack trace: #0 {main} thrown in /var/www/html/loganalyzer/index.php on line 228

kishchan commented 2 years ago

sooo i re-did the whole Server and now i am getting this error. any help would be much appreciated please.

Fatal error: Uncaught mysqli_sql_exception: Unknown column 'processid' in 'field list' in /var/www/html/loganalyzer/classes/logstreamdb.class.php:1682 Stack trace: #0 /var/www/html/loganalyzer/classes/logstreamdb.class.php(1682): mysqli_query() #1 /var/www/html/loganalyzer/classes/logstreamdb.class.php(1624): LogStreamDB->CreateMainSQLQuery() #2 /var/www/html/loganalyzer/classes/logstreamdb.class.php(545): LogStreamDB->ReadNextRecordsFromDB() #3 /var/www/html/loganalyzer/index.php(270): LogStreamDB->ReadNext() #4 {main} thrown in /var/www/html/loganalyzer/classes/logstreamdb.class.php on line 1682

alorbach commented 2 years ago

sooo i re-did the whole Server and now i am getting this error. any help would be much appreciated please.

Fatal error: Uncaught mysqli_sql_exception: Unknown column 'processid' in 'field list' in /var/www/html/loganalyzer/classes/logstreamdb.class.php:1682 Stack trace: #0 /var/www/html/loganalyzer/classes/logstreamdb.class.php(1682): mysqli_query() #1 /var/www/html/loganalyzer/classes/logstreamdb.class.php(1624): LogStreamDB->CreateMainSQLQuery() #2 /var/www/html/loganalyzer/classes/logstreamdb.class.php(545): LogStreamDB->ReadNextRecordsFromDB() #3 /var/www/html/loganalyzer/index.php(270): LogStreamDB->ReadNext() #4 {main} thrown in /var/www/html/loganalyzer/classes/logstreamdb.class.php on line 1682

There are database fields missing, usually loganalyzer should create missing fields on the fly. Here is a full SQL Script with all database fields:

CREATE TABLE `systemevents` (
  `ID` int(10) UNSIGNED NOT NULL,
  `CustomerID` int(11) NOT NULL DEFAULT 0,
  `ReceivedAt` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `DeviceReportedTime` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `Facility` int(11) NOT NULL DEFAULT 0,
  `Priority` int(11) NOT NULL DEFAULT 0,
  `FromHost` varchar(60) NOT NULL DEFAULT '',
  `Message` text NOT NULL,
  `NTSeverity` char(3) NOT NULL DEFAULT '',
  `Importance` char(3) NOT NULL DEFAULT '',
  `EventSource` varchar(60) DEFAULT NULL,
  `EventUser` varchar(60) NOT NULL DEFAULT '',
  `EventCategory` int(11) NOT NULL DEFAULT 0,
  `EventID` int(11) NOT NULL DEFAULT 0,
  `EventBinaryData` text NOT NULL,
  `MaxAvailable` int(11) NOT NULL DEFAULT 0,
  `CurrUsage` int(11) NOT NULL DEFAULT 0,
  `MinUsage` int(11) NOT NULL DEFAULT 0,
  `MaxUsage` int(11) NOT NULL DEFAULT 0,
  `InfoUnitID` int(11) NOT NULL DEFAULT 0,
  `SysLogTag` varchar(60) DEFAULT NULL,
  `EventLogType` varchar(60) DEFAULT NULL,
  `GenericFileName` varchar(60) DEFAULT NULL,
  `SystemID` int(11) NOT NULL DEFAULT 0,
  `Checksum` int(11) NOT NULL DEFAULT 0,
  `processid` varchar(60) NOT NULL DEFAULT ''
)
dcolpitts commented 1 year ago

With regards to "Fatal error: Uncaught mysqli_sql_exception: Unknown column 'processid' in 'field list'", it appeared as a 500 error in the browser. After lots of troubleshooting and testing, I found that config wizard created the table, and the first 24 columns, but the table did not have columns for Checksum or processid. I have no idea why.

The table create script that alorbach provide puked for me with an error (and yes I even dropped the table and tried it). Along the way I tried several other things.

I eventually discovered if ran this, it would fix it:

mysql -u root -p
USE Syslog;
ALTER TABLE SystemEvents
ADD COLUMN checksum INT NOT NULL;
ALTER TABLE SystemEvents
ADD COLUMN processid VARCHAR(60) NOT NULL;
exit

dcc

pompfe commented 4 months ago

addition: you have to set checksum and processid default to NULL.