# Logstash filters to analyze data

**URL:** <https://discuss.elastic.co/t/logstash-filters-to-analyze-data/235568>\
**Category:** Logstash\
**Tags:** filebeat\
**Created:** [June 3, 2020, 2:10pm UTC](https://discuss.elastic.co/t/logstash-filters-to-analyze-data/235568 "2020-06-03T14:10:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Saber\_Ben\_Njima](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/saber_ben_njima/32/65110_2.png) [@Saber\_Ben\_Njima](https://discuss.elastic.co/u/Saber_Ben_Njima)\
**Post date:** [June 3, 2020, 2:10pm UTC](https://discuss.elastic.co/t/logstash-filters-to-analyze-data/235568/1 "2020-06-03T14:10:18Z")

</div>

i have sent logs from filebeat to logstash with different tags to treat them with different ways so this is the format of a line of one of my log files so i don't know how to analyze it .  
17-02-2020 03:08:20TO -\> | Brand : TT | Channel : sms | user\_id : 14567 | DirNum : 96708790 | identity ( idType : 1 idNumber : G2CH136G ) | country : lybie | Msisdn : 92091418 | IMSI : 892160208015358468 Status : 1 Out Code : Error while activating the sim .  
So can anyone helps me to know how to put condition in the field status to only show the lines how met an error (who have a status different to 0) and finally to save to an index elasticsearch only timestamp , Msisdn and the error message  
i'll be very thankful if one will help me to face this issue

---

<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:** [June 3, 2020, 2:46pm UTC](https://discuss.elastic.co/t/logstash-filters-to-analyze-data/235568/2 "2020-06-03T14:46:32Z")

</div>

I would try something like

```
dissect { mapping => { "message" => "%{[@metadata][ts]}T%{}" } }
date { match => ["[@metadata][ts]", "ISO8601" ] }
grok {
    break_on_match => false
    match => {
        "message" => [
            "Status : %{NUMBER:status} ",
            "Msisdn : %{NUMBER:msisdn} ",
            "Code : %{DATA:errorMessage}"
        ]
    }
}
if [status] == "0" { drop {} }
```

---

<div class="post-metadata">

**Author:** ![Saber\_Ben\_Njima](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/saber_ben_njima/32/65110_2.png) [@Saber\_Ben\_Njima](https://discuss.elastic.co/u/Saber_Ben_Njima)\
**Post date:** [June 3, 2020, 3:09pm UTC](https://discuss.elastic.co/t/logstash-filters-to-analyze-data/235568/3 "2020-06-03T15:09:02Z")

</div>

thank you very much for your reply it helps me a lot to know how to deal with this problem but i don't understand how you identify fields to focus only on values in this pairs and to deal with this separator |

---

<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 1, 2020, 3:09pm UTC](https://discuss.elastic.co/t/logstash-filters-to-analyze-data/235568/4 "2020-07-01T15:09:03Z")

</div>

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