Can I get a specific time a file was downloaded and by IP?

I’m wondering if there’s a way I can get the IP address of the user who downloaded a publicly available file? I can see that a file was downloaded and what time, but I’d like to know what IP the request came from.

It’d be in the web server and/or proxy logs, depending on your setup.

You can e.g. install the Activities for shared file downloads app to create an activity on all downloads, but as far as I remember it is not logging the ip address if you’ve shared a link e.g. by email.

Yepp that app does not log the ip address. It only logs the download if its a public link. It will show the email downloading if its shared via email. But not the ip. This would perhaps be something to add.

Like @putt1ck mentioned the easiest way to get the ip currently seems to be the log. You can use the following command for the nginx access log (should be very similar for apache):

zgrep -h /s/FnsA9PKkXwff9n3 /var/log/nginx/access.log* | awk -F" " '{print $4 $5": " $1}'

results in lines like
[08/Nov/2019:10:36:51+0100]: fe80::2438:3e5c:93f4:c191
Just replace the path behind the /s/ with your shared file name.