# How to create filter for strings with separator and calculate string?

**URL:** <https://discuss.elastic.co/t/how-to-create-filter-for-strings-with-separator-and-calculate-string/310073>\
**Category:** Logstash\
**Created:** [July 19, 2022, 9:57pm UTC](https://discuss.elastic.co/t/how-to-create-filter-for-strings-with-separator-and-calculate-string/310073 "2022-07-19T21:57:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bohdan\_Repetskyi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bohdan_repetskyi/32/98480_2.png) [@Bohdan\_Repetskyi](https://discuss.elastic.co/u/Bohdan_Repetskyi)\
**Post date:** [July 19, 2022, 9:57pm UTC](https://discuss.elastic.co/t/how-to-create-filter-for-strings-with-separator-and-calculate-string/310073/1 "2022-07-19T21:57:26Z")

</div>

I have a simple config file:

```auto
input {
  file{
    path => "/tmp/data_for_logstach"
    start_position => "beginning"
    }
}
filter {
}
output {
  file{
    path => "/tmp/logstash_convert"
    action => "update"
  }
}

```

How can I filter the log file with the following content?

```auto
2022-07-19 16:39:01.238595 [115454] SEND CHNL 3 ('127.0.0.1') SBM    
2022-07-19 16:39:01.248937 [115454] RECV CHNL 3 ('127.0.0.1') SBM_RSP
2022-07-19 16:39:01.314584 [115454] RECV CHNL 51 ('127.0.0.1') SBM_RSP
2022-07-19 16:39:01.328134 [115454] RECV CHNL 3 ('127.0.0.1') SBM    
2022-07-19 16:39:01.330623 [115454] SEND CHNL 3 ('127.0.0.1') SBM_RSP
2022-07-19 16:39:01.456351 [115454] RECV CHNL 1465 ('127.0.0.1') DLV

```

The result that I expect to get:

```auto
command:SBM id:3 count:2
command:SBM_RSP id:3 count:2
command:SBM_RSP id:51 count:1
command:DLV id:1465 count:1

```

---

<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:** [August 16, 2022, 9:58pm UTC](https://discuss.elastic.co/t/how-to-create-filter-for-strings-with-separator-and-calculate-string/310073/2 "2022-08-16T21:58:12Z")

</div>

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