# User\_ip\_address\_histories is not populated

**URL:** https://meta.discourse.org/t/user-ip-address-histories-is-not-populated/255191
**Category:** Support
**Created:** [February 15, 2023, 7:47am UTC](https://meta.discourse.org/t/user-ip-address-histories-is-not-populated/255191 "2023-02-15T07:47:21Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![markschmucker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markschmucker/32/141599_2.png) [@markschmucker](https://meta.discourse.org/u/markschmucker)
#### Post date: [February 15, 2023, 7:47am UTC](https://meta.discourse.org/t/user-ip-address-histories-is-not-populated/255191/1 "2023-02-15T07:47:21Z")

</div>

In [Data Explorer](https://meta.discourse.org/t/32566?silent=true), the user\_ip\_address\_histories table has no rows. Is this expected? Can I enable logging User IPs somehow?

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [February 16, 2023, 8:54am UTC](https://meta.discourse.org/t/user-ip-address-histories-is-not-populated/255191/2 "2023-02-16T08:54:28Z")

</div>

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/app/models/user.rb at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/main/app/models/user.rb#L1001).

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:

```ruby
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.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 16, 2023, 11:38am UTC](https://meta.discourse.org/t/user-ip-address-histories-is-not-populated/255191/3 "2023-02-16T11:38:12Z")

</div>

Try this:

```plaintext
cd /var/discourse 
./launcher enter app
rails c
SiteSetting.keep_old_ip_address_count = 10
exit
exit

```

---

<div class="post-metadata">

### Author: ![markschmucker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/markschmucker/32/141599_2.png) [@markschmucker](https://meta.discourse.org/u/markschmucker)
#### Post date: [February 24, 2023, 7:24am UTC](https://meta.discourse.org/t/user-ip-address-histories-is-not-populated/255191/4 "2023-02-24T07:24:47Z")

</div>

That worked- thanks @simon and @pfaffman!

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [March 26, 2023, 7:25am UTC](https://meta.discourse.org/t/user-ip-address-histories-is-not-populated/255191/5 "2023-03-26T07:25:14Z")

</div>

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