# Possible to not log user IP addresses?

**URL:** https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502
**Category:** Support
**Created:** [6월 27, 2016, 11:52오전 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502 "2016-06-27T11:52:14Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![tagawa](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tagawa/32/121468_2.png) [@tagawa](https://meta.discourse.org/u/tagawa)
#### Post date: [6월 27, 2016, 11:52오전 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502/1 "2016-06-27T11:52:14Z")

</div>

In the admin screen for users we can see their last visited and registered IP addresses. In line with my company’s approach to privacy, we don’t want to record these but I can’t see a setting to switch it off. Is there something I’m missing, or would we have to fork Discourse? Or perhaps a plugin could override the code?

Any help is appreciated.

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [6월 27, 2016, 11:58오전 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502/2 "2016-06-27T11:58:41Z")

</div>

There are a number of anti-abuse measures that rely on having knowledge of the client IP address in order to function. Also, the client IP is logged in a _number_ of places, including at least two different log files (nginx access log and rails log), so you’ll need to modify some pretty deep config in order to get rid of those, too. And yes, I’d say you’re likely going to need to fork to eradicate all those.

---

<div class="post-metadata">

### Author: ![tagawa](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tagawa/32/121468_2.png) [@tagawa](https://meta.discourse.org/u/tagawa)
#### Post date: [6월 27, 2016, 12:02오후 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502/3 "2016-06-27T12:02:19Z")

</div>

Thank you for the quick answer Matt. We’ve already worked on the log files to stop IP addresses being recorded there. Looks like we’ll have to dig deeper for the remainder to not be logged. Seems to be beyond what a plugin can achieve.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [6월 27, 2016, 12:29오후 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502/4 "2016-06-27T12:29:19Z")

</div>

You could likely setup a nginx proxy in front of Discourse and have it pass in 0.0.0.0 for all IP addresses.

`proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;`

---

<div class="post-metadata">

### Author: ![tagawa](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tagawa/32/121468_2.png) [@tagawa](https://meta.discourse.org/u/tagawa)
#### Post date: [6월 27, 2016, 1:18오후 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502/5 "2016-06-27T13:18:43Z")

</div>

Thanks very much @cpradio, that sounds like a good idea. I’ll suggest it to our developers.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [6월 27, 2016, 1:25오후 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502/6 "2016-06-27T13:25:48Z")

</div>

Then you will need to turn off rate limiting, because everything will look like a DDOS.

---

<div class="post-metadata">

### Author: ![tagawa](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tagawa/32/121468_2.png) [@tagawa](https://meta.discourse.org/u/tagawa)
#### Post date: [6월 27, 2016, 1:34오후 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502/7 "2016-06-27T13:34:17Z")

</div>

Good thinking @Falco. I’ll change the rate settings if we go down that route.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [6월 27, 2016, 3:22오후 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502/8 "2016-06-27T15:22:42Z")

</div>

Maybe it would be easier to let the IPs be recorded and then periodically run a query that changes them to random private ip addresses, say daily?

---

<div class="post-metadata">

### Author: ![tagawa](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tagawa/32/121468_2.png) [@tagawa](https://meta.discourse.org/u/tagawa)
#### Post date: [6월 27, 2016, 4:32오후 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502/9 "2016-06-27T16:32:49Z")

</div>

Thanks @codinghorror. Ideally we don’t want the IPs touching our database/logs but that’s something to consider.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [6월 27, 2016, 8:58오후 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502/10 "2016-06-27T20:58:38Z")

</div>

Another idea is to intercept the IP lookup call and replace it with a modified, random version of the “real” IP (so every request doesn’t appear to come from the same IP, or a totally random IP). That would probably be safest in my opinion.

---

<div class="post-metadata">

### Author: ![tagawa](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tagawa/32/121468_2.png) [@tagawa](https://meta.discourse.org/u/tagawa)
#### Post date: [6월 28, 2016, 7:40오전 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502/11 "2016-06-28T07:40:13Z")

</div>

@codinghorror That sounds like a really good compromise, avoiding having to turn off rate limiting. We’ll probably go with this, barring difficulties. Thanks for all the help to find a solution.

---

<div class="post-metadata">

### Author: ![mrphs](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mrphs/32/70153_2.png) [@mrphs](https://meta.discourse.org/u/mrphs)
#### Post date: [1월 14, 2017, 7:21오후 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502/12 "2017-01-14T19:21:22Z")

</div>

Hey @tagawa, I’m in a [similar situation](https://meta.discourse.org/t/privacy-feature-request-disabling-or-hashing-logs-using-cryptolog-or-similar/55417) and was wondering if you’ve found a good solution to this?

---

<div class="post-metadata">

### Author: ![eve](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eve/32/344604_2.png) [@eve](https://meta.discourse.org/u/eve)
#### Post date: [8월 19, 2017, 12:43오후 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502/13 "2017-08-19T12:43:10Z")

</div>

Can someone provide a solution for this, pls? I am not familiar with the internals of Discourse, so a step-by-step instruction is much appreciated. Thx!

---

<div class="post-metadata">

### Author: ![elijah](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elijah/32/104055_2.png) [@elijah](https://meta.discourse.org/u/elijah)
#### Post date: [8월 20, 2017, 5:11오전 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502/14 "2017-08-20T05:11:17Z")

</div>

All of the solutions here work outside of Discourse, changing how nginx, the http software used, understands the IP address (and Discourse then will trust the value received from nginx). None of the solutions here look “fully baked”. So the instructions you want don’t exist.

---

<div class="post-metadata">

### Author: ![eve](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eve/32/344604_2.png) [@eve](https://meta.discourse.org/u/eve)
#### Post date: [8월 20, 2017, 7:22오전 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502/15 "2017-08-20T07:22:31Z")

</div>

Thanks for clarification.  
So in fact the answer to privacy concerns people have with Discourse is “Not our problem!”, right? That is my interpretation of the answers given here.

---

<div class="post-metadata">

### Author: ![elijah](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elijah/32/104055_2.png) [@elijah](https://meta.discourse.org/u/elijah)
#### Post date: [8월 20, 2017, 7:34오전 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502/16 "2017-08-20T07:34:08Z")

</div>

Privacy of the _never log IP addresses_ sort is a real outlier. Most admins want to have IP addresses for some amount of time for identifying rogue behavior. For example, password change requests are limited to a certain number per hour per account per IP address (pretty sure the limit there is 6). Take away IP and that doesn’t work.

So “Not our problem!” is a very unfair characterization of your request.

---

<div class="post-metadata">

### Author: ![eve](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eve/32/344604_2.png) [@eve](https://meta.discourse.org/u/eve)
#### Post date: [8월 20, 2017, 7:54오전 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502/17 "2017-08-20T07:54:52Z")

</div>

Sorry, i don’t meant to be rude. It’s kind of annoying to be left with unclear hints and not to know how to proceed.  
The best info i’ve found on nginx and masking ip address is this blog post: [Data Masking for User Privacy with the NGINX JavaScript Module – NGINX Community Blog](https://www.nginx.com/blog/data-masking-user-privacy-nginscript/)  
Here begins my problem: how do i implement this for Discourse? And not to lose the changes made with the next rebuild? I have installed Discourse via Docker which is the only supported way if i remember correctly.

---

<div class="post-metadata">

### Author: ![elijah](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elijah/32/104055_2.png) [@elijah](https://meta.discourse.org/u/elijah)
#### Post date: [8월 20, 2017, 5:10오후 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502/18 "2017-08-20T17:10:44Z")

</div>

> [@eve](#):
>
> Here begins my problem: how do i implement this for Discourse?

That solution requires the commercial version of nginx, not the open source one. The simple solution to use that without interfering with the Docker install is to get that version of nginx as a proxy for your Discourse and to use the IP address rewriter to create the X-Forwarded-For header.

---

<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: [8월 31, 2019, 2:57오전 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502/19 "2019-08-31T02:57:30Z")

</div>



---

<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: [3월 25, 2023, 7:57오전 UTC](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502/20 "2023-03-25T07:57:01Z")

</div>



[다음 페이지](https://meta.discourse.org/t/possible-to-not-log-user-ip-addresses/46502.md?page=2)
