# Count existing files pattern

**URL:** <https://discuss.elastic.co/t/count-existing-files-pattern/380990>\
**Category:** Elasticsearch\
**Created:** [August 13, 2025, 8:42am UTC](https://discuss.elastic.co/t/count-existing-files-pattern/380990 "2025-08-13T08:42:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![HarimbolaSantatra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/harimbolasantatra/32/136974_2.png) [@HarimbolaSantatra](https://discuss.elastic.co/u/HarimbolaSantatra)\
**Post date:** [August 13, 2025, 8:42am UTC](https://discuss.elastic.co/t/count-existing-files-pattern/380990/1 "2025-08-13T08:42:28Z")

</div>

We are monitoring a Wildfly deployments using Elasticsearch.  
Deployment status are done using [Marker files on Wildfly](https://docs.wildfly.org/35/Admin_Guide.html#marker-files).  
So if a war named `example.war` is successfully deployed, it will create a file named `example.war.deployed`

What I want is to monitor the deployment status of each war files. So I want to count the number of existing files who match a specific pattern. For example:

`*.deloyed => 2`  
`*.undeployed => 3`  
`*.failed => 5`

My initial solution was to create a cron script and use `curl` to send the data to ES. But I wonder if there is a better way to do this using the ES Stack.

Thanks you! 👍

---

<div class="post-metadata">

**Author:** ![Tortoise](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tortoise/32/147587_2.png) [@Tortoise](https://discuss.elastic.co/u/Tortoise)\
**Post date:** [August 13, 2025, 11:39am UTC](https://discuss.elastic.co/t/count-existing-files-pattern/380990/2 "2025-08-13T11:39:06Z")

</div>

Hello @HarimbolaSantatra

Could you please share what data is being monitored currently for Wildfly & if we have this information already in Elasticsearch? Like this information of failure/deployment details are written in logs & those are sent to elasticsearch?

> [@HarimbolaSantatra](#):
>
> We are monitoring a Wildfly deployments using Elasticsearch.

Just wondering as if the data is available in any of the logs which are sent to elasticsearch then we might not require to use curl & use the existing data to capture the information you need in dashboard.

If not you as you suggested you can use curl/beats to send data to elasticsearch.

Thanks!!

---

<div class="post-metadata">

**Author:** ![HarimbolaSantatra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/harimbolasantatra/32/136974_2.png) [@HarimbolaSantatra](https://discuss.elastic.co/u/HarimbolaSantatra)\
**Post date:** [August 13, 2025, 12:29pm UTC](https://discuss.elastic.co/t/count-existing-files-pattern/380990/3 "2025-08-13T12:29:37Z")

</div>

The failure of deployment is indeed written in Wildfly log file. I can use filebeat and logstash to read that file and extract the number of deployment failure or success.

It is a bit tricky because, say I want to deploy `example.war`, I need to check every line with `example.war` to see if the result is success or failure.
