3

Does the RPI have a log file stored somewhere (perhaps /var/log) for network interactions (such as connections, disconnections, etc.)?

ds_secret
  • 169
  • 2
  • 8

2 Answers2

3

It depends what information exactly do you want to get. The first look is to the journal:

rpi ~$ journalctl

You can search for the interface name (e.g. eth0, wlan0) and will find if it gained carrier and something like that. Looking for systemd-networkd or wpa_supplicant will give you an overview about these services:

rpi ~$ journalctl --unit=systemd-networkd
rpi ~$ journalctl --unit=wpa_supplicant

But you will not find information about devices that are connected or disconnected to the WiFi if you are using an access point. To get this you may consider to make a simple script that logs these events to a file. For wpa_supplicant you can use

rpi ~$ sudo wpa_cli -a action-file

This will wpa_cli run in daemon mode executing the action file based on events from wpa_supplicant. For an example you can look at Run a script when wifi is connected to a particular wifi network?.

If you want to monitor all interfaces with a script you can use Make ifplugd available again since Raspbian Stretch.

Ingo
  • 40,606
  • 15
  • 76
  • 189
1

journalctl --unit=dhcpcd may also be of interest

Adam Reis
  • 195
  • 1
  • 5