# Anomaly Detection for Rare IPs

**URL:** <https://discuss.elastic.co/t/anomaly-detection-for-rare-ips/314013>\
**Category:** Elastic Stack\
**Tags:** elastic-stack-machine-learning\
**Created:** [September 8, 2022, 5:58pm UTC](https://discuss.elastic.co/t/anomaly-detection-for-rare-ips/314013 "2022-09-08T17:58:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_Mobley](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tim_mobley/32/94741_2.png) [@Tim\_Mobley](https://discuss.elastic.co/u/Tim_Mobley)\
**Post date:** [September 8, 2022, 5:58pm UTC](https://discuss.elastic.co/t/anomaly-detection-for-rare-ips/314013/1 "2022-09-08T17:58:31Z")

</div>

I am attempting to create a ML job to detect rare source IPs. Using the Anomaly Detection wizard, I selected `Categorization`, then picked `Rare` and picked the `source.address` for Categorization field. However, I get the following error:

```auto
Selected category field is invalid
1000 field values analyzed, 0% contain 3 or more tokens.

```

Can someone explain to me what type of ML job I should use to accomplish this?

---

<div class="post-metadata">

**Author:** ![richcollier](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/richcollier/32/115035_2.png) [@richcollier](https://discuss.elastic.co/u/richcollier)\
**Post date:** [September 12, 2022, 11:03am UTC](https://discuss.elastic.co/t/anomaly-detection-for-rare-ips/314013/2 "2022-09-12T11:03:24Z")

</div>

[Categorization](https://www.youtube.com/watch?v=wPd_JWWfre4) is used to process unstructured text, not to deal with fields like IP addresses. You can just apply `rare` to the IP address by setting the IP address as the `by_field`. See this [older article](https://discuss.elastic.co/t/dec-4th-2018-en-ml-rarity-analysis-with-machine-learning/158979) for examples.

Also, see this [other idea](https://discuss.elastic.co/t/ml-job-rare-function-to-detect-anomaly-on-ip-address-will-report-ip-on-same-network-as-anomaly/246213) about only analyzing the first octet of IP addresses

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 10, 2022, 11:03am UTC](https://discuss.elastic.co/t/anomaly-detection-for-rare-ips/314013/3 "2022-10-10T11:03:31Z")

</div>

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