MacBook – Wi-Fi says connected, but the internet does not work until I turn it on and off

macbook proNetworkwifi

I just got my first macbook, an used early 2014 14-inch macbook air, with Mac OS Mojave. And everything works fine but when im connected to the wifi, after like about 20-30 minutes it just stops working. and it always starts working back up when I turn wifi on and off, or when I disconnect off the network, and connect back up.
It says I am still connected to the network, but there is no internet.
I already tried doing a wireless diagnosis and tried contacting apple support multiple times.

UPDATE:

Unused argument: –
Too many arguments to 'show' verb
usage: log show [options] <archive>
   or: log show [options]

description:
    Show the contents of the system log datastore or a log archive.
    Output contains only default level messages unless --info and/or
    --debug are specified.

options:
    --[no-]backtrace              Control whether backtraces are shown
    --[no-]debug                  Control whether "Debug" events are shown
    --[no-]info                   Control whether "Info" events are shown
    --[no-]loss                   Control whether message loss events are shown
    --[no-]signpost               Control whether signposts are shown
    --color <mode>                Control color output (valid: auto, always, none)
    --end <date>                  Display events up to the given end date
    --last <num>[m|h|d]           Display recent events up to the given limit
    --predicate <predicate>       Filter events using the given predicate
    --source                      Annotate output with source file and line-number
    --start <date>                Display events from the given start date
    --style <style>               Output format (valid: syslog, json, compact)
    --timezone local | <tz>       Use the given timezone when displaying event timestamps
    --mach-continuous-time        Print mach continuous time timestamps rather than walltime

valid time formats:
    'Y-M-D H:m:s+zzzz', 'Y-M-D H:m:s', 'Y-M-D', '@unixtime'

predicate usage:
    Filter predicates follow the NSPredicate format described at:
    https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Predicates/AdditionalChapters/Introduction.html

    For predicate field/type details, see `log help predicates`.

This is what showed up after the last step I was told.

enter image description here

Please help me out if somebody knows what is going on

Best Answer

The Terminal command to show WiFi disconnects for last 24 hours is:

log show --predicate '(processImagePath contains "kernel") && (eventMessage contains "AirPort: Link Down")' --style syslog --last 1d

and the output looks like this

enter image description here