# Logstash filter on number

**URL:** <https://discuss.elastic.co/t/logstash-filter-on-number/223474>\
**Category:** Logstash\
**Created:** [March 13, 2020, 8:26am UTC](https://discuss.elastic.co/t/logstash-filter-on-number/223474 "2020-03-13T08:26:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kamandohl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kamandohl/32/25391_2.png) [@kamandohl](https://discuss.elastic.co/u/kamandohl)\
**Post date:** [March 13, 2020, 8:26am UTC](https://discuss.elastic.co/t/logstash-filter-on-number/223474/1 "2020-03-13T08:26:40Z")

</div>

Trying to filter on an number, in this case 4624, in Logstash. But unable to get it to work. I was able to key off of `event.kind`, but that is a word and all events have that, so not an option. I have looked for days and unable to find anyone that has had the same issue, but no such luck. Thanks.

Example:

```
"event": {
    "code": 4624,
    "kind": "event",
    "created": "2020-03-13T08:06:30.606Z",
    "action": "Logon"

```

Filters I have tried.

```
if [event][code] == "4624" {
mutate {
  add_tag => ["testing"]
  }
}

if "4624" in [event][code] {
  mutate {
    add_tag => ["testing"]
  }
}

if [4624] in [event][code] {
    mutate { add_tag => ["testing"] }
     } 
    }
if [event][code] =~ "4624" {
mutate {
  add_tag => ["testing"]
  }

 if [event][code] =~ 4624 {
          mutate { add_tag => ["testing"] }
     }
  }
```

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [March 13, 2020, 5:54pm UTC](https://discuss.elastic.co/t/logstash-filter-on-number/223474/2 "2020-03-13T17:54:39Z")

</div>

Have you tried comparing it to a number?

```
if [event][code] == 4624 {
```

---

<div class="post-metadata">

**Author:** ![kamandohl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kamandohl/32/25391_2.png) [@kamandohl](https://discuss.elastic.co/u/kamandohl)\
**Post date:** [April 7, 2020, 10:42am UTC](https://discuss.elastic.co/t/logstash-filter-on-number/223474/3 "2020-04-07T10:42:30Z")

</div>

Badger,

Apolgies, this is how we got it to work.

if [event][kind] == "event" and [event][code] == 4624 {

---

<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:** [May 5, 2020, 10:42am UTC](https://discuss.elastic.co/t/logstash-filter-on-number/223474/4 "2020-05-05T10:42:35Z")

</div>

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