# Monitoring File Presence Dynamically? (Log files with dates)

**URL:** <https://community.dynatrace.com/t/monitoring-file-presence-dynamically-log-files-with-dates/47649>\
**Category:** Logs\
**Tags:** log-monitoring-class, extensions, logs\
**Created:** [September 13, 2024, 1:16pm UTC](https://community.dynatrace.com/t/monitoring-file-presence-dynamically-log-files-with-dates/47649 "2024-09-13T13:16:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![PedroSantos](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pedrosantos/32/28150_2.png) [@PedroSantos](https://community.dynatrace.com/u/PedroSantos)\
**Post date:** [September 13, 2024, 1:16pm UTC](https://community.dynatrace.com/t/monitoring-file-presence-dynamically-log-files-with-dates/47649/1 "2024-09-13T13:16:04Z")

</div>

Hello community, I could use your advice with something.

I’m trying to monitor the presence of a file on a given directory. The easiest and most simple solution would be to use the Filesystem Extension, which allows me to use a count to do just that.

![PedroSantos_0-1726233006512.png](https://global.discourse-cdn.com/dynatrace/original/2X/6/64c291fb9e3a99e1170dc4df7a22cce279d3701d.png)

The limiting factor is that the only available configurations for count are the following:

 ![PedroSantos_1-1726233057992.png](https://global.discourse-cdn.com/dynatrace/original/2X/2/2b89b46f9bcf185ee5eeb726fada23bfde63ad99.png)

My problem:

**The name of the log file I need to check for changes daily,** because the date is appended to the daily created file.

So today I would need to look for 13092024\_logfile.log

But tomorrow I’ll have to check if 14092024\_logfile.log is present, on the same directory. And yesterday’s log file will be there too, so I can’t do a simple count of files.

Given how common it is to append dates to log file names, I figured someone here must’ve dealt with this problem before.

Any insight, advice or counsel on how to deal with this situation would be greatly appreciated 😃

---

<div class="post-metadata">

**Author:** ![PedroSantos](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/pedrosantos/32/28150_2.png) [@PedroSantos](https://community.dynatrace.com/u/PedroSantos)\
**Post date:** [September 19, 2024, 2:43pm UTC](https://community.dynatrace.com/t/monitoring-file-presence-dynamically-log-files-with-dates/47649/2 "2024-09-19T14:43:43Z")

</div>

Double post, just in case someone bumps into the same issue I did. I found a solution on the same menu:

 ![PedroSantos_0-1726756991250.png](https://global.discourse-cdn.com/dynatrace/original/2X/e/ed221cd7ddca85fcb6489dedce868962fff7d6b4.png)

It wasn’t immediately obvious for me, so I thought I’d share the solution anyway.

---

<div class="post-metadata">

**Author:** ![AntonPineiro](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antonpineiro/32/49_2.png) [@AntonPineiro](https://community.dynatrace.com/u/AntonPineiro)\
**Post date:** [September 22, 2024, 10:38am UTC](https://community.dynatrace.com/t/monitoring-file-presence-dynamically-log-files-with-dates/47649/3 "2024-09-22T10:38:22Z")

</div>

Hi,

If existing extensions are not matching your use case, you can always create your own script for checking file exist or not.

For example, script output can ingest “1” if exist; and “0” if not, using [metric scripting integration](https://docs.dynatrace.com/docs/shortlink/pipe-metric-ingestion).

Best regards

---

<div class="post-metadata">

**Author:** ![adam\_gardner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/adam_gardner/32/20087_2.png) [@adam\_gardner](https://community.dynatrace.com/u/adam_gardner)\
**Post date:** [October 9, 2024, 3:24am UTC](https://community.dynatrace.com/t/monitoring-file-presence-dynamically-log-files-with-dates/47649/4 "2024-10-09T03:24:37Z")

</div>

Deploying an OpenTelemetry collector (such as [the supported Dynatrace collecto](https://docs.dynatrace.com/docs/extend-dynatrace/opentelemetry/collector)r) and using the [filelogreceiver](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/filelogreceiver/README.md) will achieve this:

```auto
receivers:
  filelog:
    include: [c:\path\to\logs\*.log]

```
