Mwan3: log that shows failovers?

Hi guys,

is there a way I could enable a log file to be written logging that would show when mwan3 decides to fail over to the other WAN interface?

I'm seeing some weird issues (suddenly being kicked out of remote sessions as if my source IP changed), and I would like to confirm my suspicion. I couldn't find anything on Google, this is why I'm now asking here... :slight_smile:

Thanks in advance for any help.

Kr,

Ralf

if you don't want to reduce the life of the router's flash you will have to activate external support (usbpen, hard disk, etc.) if you want file persistence

you will have to create a script that monitors the active interfaces and writes notifications to you in a file

2 Likes

Thanks for your comments.

I was not precise with my question, sorry. I rephrased it: "enable logging that would show..."

So anything that does into the normal transient log that can be read with "logread" would be perfectly fine.

(I'm logging that to a remote server, but for this particular purpose I don't even need persistence at all -- I just need to be able to check ad-hoc if a fail-over occurred in case I notice a problem that I suspect may be due to such fail-over).

So pointing me to the "hook" means currently such events are not logged at all?

And in the event script I would use logger -t TAG MESSAGE to log the event, I suppose?

Thanks again.

if you only want the log see:

you don't need any script only enable logging ... :slightly_smiling_face:

example:

Add in /etc/mwan3.user the following:

if [ "${ACTION}" = "disconnected" ] && [ "${INTERFACE}" = "wanb" ] ; then
logger -t MWAN3 "Connection wanb went down."
fi
2 Likes

Thanks. You recommend the logging option, I suppose?

I saw that this option exists but was almost 100% sure it's not what I want, because it speaks about "firewall logging."

Are you sure that it doesn't flood the log with lots of output? I only want a single line saying something similar to "wanA failed, failing over to wanB".

(I can't test it at the moment because my network is "productive", and I have two people working over it right now...)

Thanks. Basically exactly what I had in mind... :wink:

1 Like

I think you may have meant /etc/mwan3.user?

1 Like

That's correct.

1 Like

By enabling logging, any event would be recorded based on the level (emerg, alert, crit, error, warning, notice, info, debug)

excellent response from:

1 Like

Thanks again.

I'm confused now.

I don't have any line in /etc/config/mwan3 about logging:

root@gw:/etc/config# grep -c -i log /etc/config/mwan3
0

So the default of a log level of notice should apply.

Still I see messages like the below in logread:

Wed Oct 11 20:30:07 2023 user.info mwan3track[1947]: Check (ping) failed for target "1.0.0.1" on interface wan (wan). Current score: 10
Wed Oct 11 23:08:54 2023 user.info mwan3track[1948]: Check (ping) failed for target "2606:4700:4700::1111" on interface wan6 (wan). Current score: 10
Thu Oct 12 02:58:39 2023 user.info mwan3track[1948]: Check (ping) failed for target "2606:4700:4700::1001" on interface wan6 (wan). Current score: 10
Thu Oct 12 03:49:07 2023 user.info mwan3track[1948]: Check (ping) failed for target "2606:4700:4700::1001" on interface wan6 (wan). Current score: 10
Thu Oct 12 16:36:11 2023 user.info mwan3track[1948]: Check (ping) failed for target "2606:4700:4700::1001" on interface wan6 (wan). Current score: 10

Note that the level of these messages is info, and as info is less than notice, they should be suppressed.

Now that I think about it again, I believe the above messages are not related to "rules", because it's not about "what traffic to match and what policy to assign for that traffic". So it seems everything is alright. :slight_smile:

I've marked @trendy 's response as the solution, it seems you also agree. :slight_smile:

yes best answer to your question

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.