# Initialize counter in logstash and replace the '%{\[message\]\[0\]}'?

**URL:** <https://discuss.elastic.co/t/initialize-counter-in-logstash-and-replace-the-message-0/304912>\
**Category:** Logstash\
**Created:** [May 17, 2022, 9:36am UTC](https://discuss.elastic.co/t/initialize-counter-in-logstash-and-replace-the-message-0/304912 "2022-05-17T09:36:14Z")\
**Posts on this page:** 1\
**Showing post:** 8

<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:** [May 17, 2022, 3:51pm UTC](https://discuss.elastic.co/t/initialize-counter-in-logstash-and-replace-the-message-0/304912/8 "2022-05-17T15:51:51Z")

</div>

If there are a limited number of formats you may be able to [count the number of columns](https://discuss.elastic.co/t/using-ruby-to-count-the-number-of-fields-in-a-message-then-apply-csv-depending-on-the-count/177880/2) and use that to determine which csv filter to use.

---

_[View the full topic](https://discuss.elastic.co/t/initialize-counter-in-logstash-and-replace-the-message-0/304912)._
