Page 1 of 1

Configuring local logging?

Posted: Sat Apr 23, 2022 6:16 pm
by Cubytus
Hi there,

n the long process to tackle an obscure but serious bug, I have to try another router and have it log everything in debug mode. Since I expect a rather large file, I wanted to put it on a USB drive, and have it rotated once it reaches 10MiB.

However, I don't see any setting in "System" that would allow me to change the log settings.

NAS-based logging or emailing logs are not an option since the bug I'm hunting for disconnects all devices from the Internet every time it's triggered.

Re: Configuring local logging?

Posted: Sat Apr 23, 2022 7:05 pm
by Lantis
The default logging system can be pointed to a file
https://openwrt.org/docs/guide-user/bas ... le_logging

For rotational file logging you’ll need to install additional packages.

Store and split logs on USB drive in Gargoyle 1.13?

Posted: Sun Apr 24, 2022 8:44 am
by Cubytus
Edit: duplicate topic (Thanks Lantis)

Re: Configuring local logging?

Posted: Sun Apr 24, 2022 8:49 am
by Lantis
Duplicate topics merged. Was there anything about the original reply that didn't work for you?

Re: Configuring local logging?

Posted: Wed Apr 27, 2022 10:01 am
by Cubytus
Hello,

it did work actually! But now, how do I set the logging level? It is supposed to be '9', but there's no way a rather active network generate only so few messages in that timeframe.

/etc/config/system snipped)

Code: Select all

config system 'system'                                                         
        option timezone 'EST5EDT,M3.2.0/2,M11.1.0/2'                           
        option ttylogin '0'                                                    
        option log_size '64'                                                   
        option log_file '/mnt/sdc1/log/messages'                               
        option log_remote '0'                                                  
        option urandom_seed '0'                                                
        option cronloglevel '9'                                                
        option hostname 'Gargoyle-N600'  
messages files in /mnt/sdc1/log/:

Code: Select all

Apr 27 10:41:58 Gargoyle-N600 hostapd: wlan0: STA 44:6e:e5:20:c6:1a IEEE 802.11: authenticated
Apr 27 10:46:58 Gargoyle-N600 hostapd: wlan0: STA 44:6e:e5:20:c6:1a IEEE 802.11: deauthenticated due to inactivity (timer DEAUTH/REMOVE)
Apr 27 11:56:51 Gargoyle-N600 hostapd: wlan0: STA d6:d8:3b:83:55:48 IEEE 802.11: authenticated
Apr 27 11:56:51 Gargoyle-N600 hostapd: wlan0: STA d6:d8:3b:83:55:48 IEEE 802.11: associated (aid 1)
Apr 27 11:56:51 Gargoyle-N600 hostapd: wlan0: AP-STA-CONNECTED d6:d8:3b:83:55:48
Apr 27 11:56:51 Gargoyle-N600 hostapd: wlan0: STA d6:d8:3b:83:55:48 RADIUS: starting accounting session 9D73F8AC7EC7C5B9
Apr 27 12:38:57 Gargoyle-N600 hostapd: wlan0: STA ea:83:48:54:e4:c1 IEEE 802.11: authenticated
Apr 27 12:38:57 Gargoyle-N600 hostapd: wlan0: STA ea:83:48:54:e4:c1 IEEE 802.11: associated (aid 2)
Apr 27 12:38:57 Gargoyle-N600 hostapd: wlan0: AP-STA-CONNECTED ea:83:48:54:e4:c1
Apr 27 12:38:57 Gargoyle-N600 hostapd: wlan0: STA ea:83:48:54:e4:c1 RADIUS: starting accounting session 16D7149A1BC94802
…Which shows yet another issue: although the Web interface shows the correct time, the timestamp in the log is 3 hours ahead. [EDIT: nevermind this part: I just forgot to restart logging.]

Re: Configuring local logging?

Posted: Wed Apr 27, 2022 6:58 pm
by Lantis
You've gone the wrong way. Lower numbers are more verbose messages, not higher.
Another potential issue (unsure if resolved) is that there are some reports that the default logging facility (logd) does not respect the log level parameter and something like syslog-ng should be used instead.
Further to that, if you're looking for hostapd logs, you need to ensure that it is also set to log at a low level.
And to top all of that off, hostapd is by default compiled in a way that strips any log messages below "info" level such that they don't even exist in the code anymore. So you'd need to recompile hostapd if you're really looking to get into the thick of it.