# Filter logs with only DEBUG in them

**URL:** <https://discuss.elastic.co/t/filter-logs-with-only-debug-in-them/137501>\
**Category:** Kibana\
**Created:** [June 26, 2018, 7:22pm UTC](https://discuss.elastic.co/t/filter-logs-with-only-debug-in-them/137501 "2018-06-26T19:22:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrkr188](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@mrkr188](https://discuss.elastic.co/u/mrkr188)\
**Post date:** [June 26, 2018, 7:22pm UTC](https://discuss.elastic.co/t/filter-logs-with-only-debug-in-them/137501/1 "2018-06-26T19:22:18Z")

</div>

Hello,

I am new to ELasticsearch. I'm having a hard time in finding out how to filter the logs in Kibana. We have ELK stack setup to view logs from kubernates cluster. I am able to get the log files using Kibana with this query. Since log is one of the field in data I get all the logs.

```auto
{
  "exists": {
    "field": "log"
  }
}

```

With this I get all logs with INFO, DEBUG, WARNING. I want to filter the logs based on string matching. I tried something like this, but it gives me an error.

```auto
{
  "exists": {
    "field": "log"
  },
 "query": {
        "regexp":{
            "name.first": "s.*y"
        }
 }
}

```

Could you please help me with the query?

---

<div class="post-metadata">

**Author:** ![cjcenizal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cjcenizal/32/11216_2.png) [@cjcenizal](https://discuss.elastic.co/u/cjcenizal)\
**Post date:** [June 26, 2018, 7:54pm UTC](https://discuss.elastic.co/t/filter-logs-with-only-debug-in-them/137501/2 "2018-06-26T19:54:13Z")

</div>

Hi there,

Try using a [BOOL query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-bool-query.html) to combine your conditions:

```auto
GET _search
{
  "query": {
    "bool" : {
      "must" : [{
        "exists" : { "field" : "log" }
      }, {
        "regexp":{
          "name.first": "s.*y"
        }
      }]
    }
  }
}

```

Does this help?

Thanks,  
CJ

---

<div class="post-metadata">

**Author:** ![mrkr188](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@mrkr188](https://discuss.elastic.co/u/mrkr188)\
**Post date:** [June 26, 2018, 9:00pm UTC](https://discuss.elastic.co/t/filter-logs-with-only-debug-in-them/137501/3 "2018-06-26T21:00:25Z")

</div>

Thanks for the answer.

It still doesn't seem to work. I think I must use some other identifier than "name.first". I tried using "log" since the field name i wanna match string is log. But it still didn't work. "wildcard" also doesn't seem to work.

Could you point me to a simple introduction to query language. I find the documents a bit too involved for a beginner like me.

---

<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:** [July 24, 2018, 9:00pm UTC](https://discuss.elastic.co/t/filter-logs-with-only-debug-in-them/137501/4 "2018-07-24T21:00:28Z")

</div>

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