I didn’t say anything about how to store info in a data table because I thought you already were doing it.
I told you what I use to get the only thing you miss, the nationality info.
Here are more details:
You can’t read from the app log.
The app log has a little info about the time of the request and about where it comes from. Plus it has all you print to it.
You can add to your table whatever you print to your log. It looks like you are already doing this.
You will need another way to find the part you miss, the country info.
All you need to do is to sign up with a service like BigDataCloud, ask for the location of the requesting IP address and add it to your table. Now your table and the app log are identical:
ip = anvil.server.context.client.ip
response = requests.get(f'https://api.bigdatacloud.net/data/ip-geolocation-with-confidence?ip={ip}&localityLanguage=en&key={BIGDATACLOUD_KEY}')
data = response.json()
app_tables.my_log.add_row({
'city': data['location']['city'],
'country': data['country']['name'],
})
I store the info of every IP address in a global dictionary. My apps are used by a few users, so a handful of requests per day are enough to add what’s missing to the local dictionary. Then all the requests coming from an IP address only require a dictionary lookup to find where they are coming from.
The app log also contains info about app failures (not mentioned in the original post), and they are impossible to get.
You could get some of them (not all) by managing all the errors and getting the info about the error and the traceback as described in this post.