# Capture Message

**URL:** <https://discuss.elastic.co/t/capture-message/227164>\
**Category:** Logstash\
**Created:** [April 8, 2020, 3:28pm UTC](https://discuss.elastic.co/t/capture-message/227164 "2020-04-08T15:28:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![manikandanb87](https://avatars.discourse-cdn.com/v4/letter/m/278dde/32.png) [@manikandanb87](https://discuss.elastic.co/u/manikandanb87)\
**Post date:** [April 8, 2020, 3:28pm UTC](https://discuss.elastic.co/t/capture-message/227164/1 "2020-04-08T15:28:13Z")

</div>

Hi Team,  
I am testing my log stash output and found that it is stashing as below.  
But, I would like to know how can I match and capture only the entries in the log - "Sign on javacode failed for user USERA"

Kindly help.

```auto
           "oprid" => "-",
         "@timestamp" => 2020-04-08T15:17:06.944Z,
        "log_message" => "Sign on javacode failed for user USERA@xxx.xxx.xx.xx..",
      "TOPInstanceID" => "1610670968891559937",
               "path" => "/searchtech/logstash-7.6.1/bin/failelogin.log",
      "app_timestamp" => "2020-03-31T11:56:24.569",
               "host" => "nonelastic",
          "serequest" => "437",
          "timestamp" => 2020-03-31T11:56:24.569Z,
           "@version" => "1",
            "process" => "JVM",
             "prcsid" => "128077",
            "service" => "login",
          "log_level" => "3",
               "SRID" => "c9qnpn/QLB2UyA"
}
{
              "oprid" => "-",
         "@timestamp" => 2020-04-08T15:17:06.944Z,
        "log_message" => "(502): USERA@xxx.xxx.xx.xx is an Invalid User ID, or you typed the wrong password. Make sure you're typing in the correct upper and lower case.",
      "TOPInstanceID" => "1610670968891559937",
               "path" => "/searchtech/logstash-7.6.1/bin/failelogin.log",
      "app_timestamp" => "2020-03-31T11:56:24.569",
	           "host" => "nonelastic",
          "serequest" => "437",
          "timestamp" => 2020-03-31T11:56:24.569Z,
           "@version" => "1",
            "process" => "JVM",
             "prcsid" => "128077",
            "service" => "login",
          "log_level" => "1",
               "SRID" => "c9qnpn/QLB2UyA"
}

```

---

<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:** [April 8, 2020, 4:05pm UTC](https://discuss.elastic.co/t/capture-message/227164/2 "2020-04-08T16:05:11Z")

</div>

Are you saying that you want to drop events that do not contain "Sign on javacode failed for user" in the [log\_message] field? You could do that using

```
if "Sign on javacode failed for user" not in [log_message] { drop {} }
```

---

<div class="post-metadata">

**Author:** ![manikandanb87](https://avatars.discourse-cdn.com/v4/letter/m/278dde/32.png) [@manikandanb87](https://discuss.elastic.co/u/manikandanb87)\
**Post date:** [April 8, 2020, 5:25pm UTC](https://discuss.elastic.co/t/capture-message/227164/3 "2020-04-08T17:25:02Z")

</div>

Thank you!.. That worked.

---

<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 6, 2020, 5:25pm UTC](https://discuss.elastic.co/t/capture-message/227164/4 "2020-05-06T17:25:03Z")

</div>

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