The Nginx log that has been continuously left unrepaired

My AXT-1800 router has been in use for about a year, but there’s one aspect that has been consistently neglected: the Nginx Log. While it doesn’t affect the functionality, for those who strive for a warning-free experience, the annoying reminders are truly unbearable.

1. "cat: can't open '/var/log/nginx/access.log': No such file or directory"

Firstly, I have previously performed a complete reset of my router to ensure it’s on default settings. The Access log is set to be off by default, so why retain this UI interface? And even if it’s kept, could some minor adjustments be made to hide it? For instance, using "[ -f /var/log/nginx/access.log ] && cat /var/log/nginx/access.log".

2. "lua_code_cache is off; this will hurt performance in /etc/nginx/conf.d/gl.conf:6"

I attempted to change it to ‘on,’ resulting in even more error logs.

3. "Oops Log extractor (build Aug 00 2023 00:00:00).
   No logs present"

I’m not sure about this one either; it even appeared randomly without me pressing any buttons.

I hope that in the future, if GL.iNet decides to close their source code, they will pay more attention to these details. It would greatly contribute to an enhanced user experience.:blush:

1 Like

I have also recently noticed such weird logs in Nginx. I need to investigate it alter when I get time. But the GL devs need to pay attention to this as well.

Login from the SSH and perform:

touch /var/log/nginx/access.log

vi /etc/nginx/conf.d/gl.conf
lua_code_cache on;

echo -n “” > /var/log/nginx/error.log
echo -n “” > /var/log/nginx/access.log

service nginx restart
service log restart

Yet “Oops Log extractor” will still appear in the logs. It seems that these are belong to the Kernel crash dump. Yet I could not yet find the cause of these lines in Nginx logs.

After digging into the issue, I have found that this noisy logs are generated by a binary that is trying to read the EMPTY /tmp/logread/crash.log:

# grep --exclude-dir=proc -a -l -r -s 'Log extractor' / 

# /usr/bin/oopslog /tmp/logread/crash.log 
Oops Log extractor (build Jan 23 2024 07:12:18).
No logs present

So whenever you click on Export Logs from GL Admin Panel, this is gets triggered! You can confirm that by inspecting the file:
vi /usr/bin/export_logs

log_dev=$(cat /proc/mtd | grep log | awk -F ':' '{print $1}')

        if [ -e "/tmp/logread.tar" ];then
                rm -rf /www/js/logread.tar
                rm -rf /tmp/logread/
                rm -rf /tmp/logread.tar

        mkdir -p /tmp/logread/nginx
        oopslog /dev/$log_dev > /tmp/logread/crash.log <------ Trouble maker ;)
        logread > /tmp/logread/system.log
        dmesg > /tmp/logread/kernel.log
        logread -e mqtt > /tmp/logread/cloud.log
        cp -r /var/log/nginx/*.log /tmp/logread/nginx

        cd /tmp
        chmod 777 -R logread/*
        tar -cvf logread.tar logread/

        ln -sf /tmp/logread.tar /www/js/logread.tar


So if you remove that line, you won’t have these logs in Nginx anymore!


Actually I removed the line shown above and the same logs still were being generated! After digging much deeper, it seems that these are generated whenever you visit the crash tab! So you can disable the TWO related functions at: /usr/lib/oui-httpd/rpc/logread by adding
do return end

This time 100 positive!