User_ip_address_histories is not populated

In Data Explorer, the user_ip_address_histories table has no rows. Is this expected? Can I enable logging User IPs somehow?

3 Likes

I was not aware of that data base table before now. It looks as though entries are only inserted into the table if the hidden keep_old_ip_address_count site setting is set to a value that is greater than 0. The default value of the setting is 0, so by default, changes to IP addresses are not logged. The code that controls this is here: discourse/user.rb at main · discourse/discourse · GitHub.

If you have access to your Discourse site’s rails console, you can enable logging of IP address changes by entering the console and running a command similar to the following:

SiteSetting.keep_old_ip_address_count = 1

In the above command, set the value of the setting to the maximum number of old IP addresses you want to log for each user.

4 Likes

Try this:

cd /var/discourse 
./launcher enter app
rails c
SiteSetting.keep_old_ip_address_count = 10
exit
exit
3 Likes

That worked- thanks @simon and @pfaffman!

1 Like

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