<p>You could add a field "IP Address" to your Entry Type and make the form submit the guest's IP (→ <a href="https://buildwithcraft.com/classreference/services/HttpRequestService#getIpAddress-detail" rel="nofollow"><code>getIpAddress()</code></a> method) via a hidden field.</p>

<pre><code>&lt;input type="hidden" name="fields[ipAddress]" value="{{ craft.request.getIpAddress() }}"&gt;
</code></pre>

<p>For further improvements you could make your own field type for "IP Address" with a plugin, that adds custom validation (→ block certain IP ranges). You could also hide the field from the CP or make it only readable.</p>

CC BY-SA 3.0
2016-06-01T12:28:20.033Z
But if you create a field, then the IP address will become searchable ... (because it is not possible to exclude fields from search).
MISC
CC BY-SA 3.0
2015-02-16T15:19:34.670Z
2015-02-16T15:19:34.670Z
carlcs
<p>I'm using the Guest Entries plugin and it's all working great, the problem is I'm getting spammed like mad. I've got snaptcha installed which seems to be catching some of it but I could do with an IP log so I can see if it is coming from a certain IP or IP range.</p>

<p>I ideally want the IP logged with the form submission as server access logs are hard to match up.</p>

<guest-entries><ip-address>
Logging IP with Guest Entries Plugin
# Logging IP with Guest Entries Plugin

(Asked by: username_0 on 2015-02-16)

I'm using the Guest Entries plugin and it's all working great, the problem is I'm getting spammed like mad. I've got snaptcha installed which seems to be catching some of it but I could do with an IP log so I can see if it is coming from a certain IP or IP range.

I ideally want the IP logged with the form submission as server access logs are hard to match up.

**Tags:** guest-entries, ip-address


---

## 1 answers

### Answer by username_1 on 2015-02-16. Score: 1 | Accepted answer

You could add a field "IP Address" to your Entry Type and make the form submit the guest's IP (→ getIpAddress() method) via a hidden field.


For further improvements you could make your own field type for "IP Address" with a plugin, that adds custom validation (→ block certain IP ranges). You could also hide the field from the CP or make it only readable.

> **Comments:**
> **username_2**: But if you create a field, then the IP address will become searchable ... (because it is not possible to exclude fields from search).  

---

