# Metricbeat - Number of processes based on patterns

**URL:** <https://discuss.elastic.co/t/metricbeat-number-of-processes-based-on-patterns/127836>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [April 12, 2018, 2:01pm UTC](https://discuss.elastic.co/t/metricbeat-number-of-processes-based-on-patterns/127836 "2018-04-12T14:01:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bayerb](https://avatars.discourse-cdn.com/v4/letter/b/f08c70/32.png) [@bayerb](https://discuss.elastic.co/u/bayerb)\
**Post date:** [April 12, 2018, 2:01pm UTC](https://discuss.elastic.co/t/metricbeat-number-of-processes-based-on-patterns/127836/1 "2018-04-12T14:01:02Z")

</div>

Hi,

in elastic in a document I would like to see the number of processes matching a given regex. For instance if there are 2 processes running with a specific name, than in a document I would like to see a "numberOfInstances"-like field with value 2.  
Is it possible to achieve this with metricbeat?  
My initial goal is to set up an alerting, whether a process fitting the regex is running at all, or whether there are too many running.

Thanks,  
Balázs

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [April 13, 2018, 2:35pm UTC](https://discuss.elastic.co/t/metricbeat-number-of-processes-based-on-patterns/127836/2 "2018-04-13T14:35:49Z")

</div>

I think this type of task is would be best to do after the data is contained in ES. So using a queries and aggregations to detect this condition would be good (and Alerting can help you automate this).

There isn't anything in Metricbeat alone that can do the kind of pre-aggregation.

---

<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 11, 2018, 2:36pm UTC](https://discuss.elastic.co/t/metricbeat-number-of-processes-based-on-patterns/127836/3 "2018-05-11T14:36:10Z")

</div>

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