# Logstash filter large message

**URL:** <https://discuss.elastic.co/t/logstash-filter-large-message/69878>\
**Category:** Logstash\
**Created:** [December 23, 2016, 7:08am UTC](https://discuss.elastic.co/t/logstash-filter-large-message/69878 "2016-12-23T07:08:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![n3uz](https://avatars.discourse-cdn.com/v4/letter/n/f6c823/32.png) [@n3uz](https://discuss.elastic.co/u/n3uz)\
**Post date:** [December 23, 2016, 7:08am UTC](https://discuss.elastic.co/t/logstash-filter-large-message/69878/1 "2016-12-23T07:08:42Z")

</div>

I am a newbie Chinese ELK user,When message value is too large ,It costs too much CPU time to handle,I dont know how to fix it,but like below.

```
ELK5.1.1
CentOS7
JDK8

```

**log output**

```
INFO 16-12-22 13:34:40.998 - The user[12345] start login
INFO 16-12-22 13:34:40.998 - The user[67890] start login
INFO 16-12-22 13:34:40.998 - Output of app log huge, like 20k Here is the Problem

```

I want to pick the userId(12345 67890 etc) up for auditing.So I did this

**logstash config**

```
filter {
        grok {
               patterns_dir => "/path/to/patterns/"
               match => ["message","%{USERLOGIN}"]
        }
        if [c] !~ "The user" {
                drop{}
         }
        if "_grokparsefailure" in [tags] {
                drop {}
        } 
}

```

**patterns file**

> USERLOGIN %{LOGLEVEL:loglev}%{SPACE}%{DATESTAMP:date}%{SPACE}%{SPACE}-%{SPACE}%{GREEDYDATA:c}

**output**

```
{
          "date" => "16-12-22 13:34:40.998",
        "loglev" => "INFO",
    "@timestamp" => 2016-12-23T06:25:29.605Z,
             "c" => "The user[12345] start login",
      "@version" => "1",
          "host" => "0.0.0.0",
          "type" => "login",
          "tags" => []
}

```

But I dont know how to filter out the userId  
How can I use mutate plugins to catch the userId ,output like this

```
{
          "date" => "16-12-22 13:34:40.998",
        "loglev" => "INFO",
    "@timestamp" => 2016-12-23T06:25:29.605Z,
             "c" => "12345",
      "@version" => "1",
          "host" => "0.0.0.0",
          "type" => "login",
          "tags" => []
}

```

Wish you guys can help me  
Even English is not my mother language,I hope you can understand me LOL

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [December 27, 2016, 5:48am UTC](https://discuss.elastic.co/t/logstash-filter-large-message/69878/2 "2016-12-27T05:48:07Z")

</div>

Try using the dissect filter, it might be more efficient.

---

<div class="post-metadata">

**Author:** ![n3uz](https://avatars.discourse-cdn.com/v4/letter/n/f6c823/32.png) [@n3uz](https://discuss.elastic.co/u/n3uz)\
**Post date:** [December 28, 2016, 3:24am UTC](https://discuss.elastic.co/t/logstash-filter-large-message/69878/3 "2016-12-28T03:24:31Z")

</div>

> [@warkolm](#):
>
> dissect

Thanks anyway

---

<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:** [January 25, 2017, 3:24am UTC](https://discuss.elastic.co/t/logstash-filter-large-message/69878/4 "2017-01-25T03:24:33Z")

</div>

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