goryn-clade / pathfinder-containers

A Docker-compose solution for Pathfinder mapping tool using Traefik
Other
62 stars 66 forks source link

[BUG] map history logging does not work #23

Closed fleischsalatinspace closed 2 years ago

fleischsalatinspace commented 3 years ago

Enabling map history logging via pathfinder.ini or UI does not work. No map logs displayed in UI or written to file

Confirmed by sam on slack

samoneilll commented 3 years ago

It appears this is an issue with the dockerization of the app, those running it on baremetal have reported that logging works fine. Transferring to pathfinder-containers project.

JorisBolsens commented 2 years ago

@samoneilll It is an issue with dockerization in that the websocket reliably works in the container, but logging via the socket seems to not.

If you comment out the bit that tries to log via socket, and only log via file, it works

        // update map history *.log files -----------------------------------------------------------------------------
        if($this->isHistoryLogEnabled()){
            // check socket config
            //if(Config::validSocketConnect(Config::getSocketUri())){
            //    $log->addHandler('socket', 'json', $this->getSocketConfig());
            //}else{
                // update log file local (slow)
            $log->addHandler('stream', 'json', $this->getStreamConfig());
            //}
        }
fleischsalatinspace commented 2 years ago

nice find @JorisBolsens . Is there any known downside in disabling the map history logging via sockets? Do you have an productive instance where you are already using this? Any performance impact?

JorisBolsens commented 2 years ago

I am using this for a fairly small pathfinder install, I have not seen any performance degradation by running it this way. I have been looking into the websocket implementation to try and understand how the socket log is supposed to work, but my grasp of php is rudimentary at best.

samoneilll commented 2 years ago

Hi @JorisBolsens, thanks for looking into this. Your discovery of the logic to log via file/socket was actually useful and after investigating I found that logs are actually being created inside the socket container as json at /var/www/html/pathfinder/history/map/ in the format map_{map_id}.log.

I think we can actually solve this by just mounting a directory from the host at this binding so that logs are persisted to host's filesystem. Maybe it's even worth setting up logrotate in the socket container to do some rotation and archiving.

samoneilll commented 2 years ago

I've created a new branch that I hope fixes logging:

https://github.com/goryn-clade/pathfinder-containers/pull/38/files

fleischsalatinspace commented 2 years ago

Fixed in https://github.com/goryn-clade/pathfinder-containers/pull/38