Monitoring File Presence Dynamically? (Log files with dates)

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

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

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 :smiley:

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

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

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.

Best regards

Deploying an OpenTelemetry collector (such as the supported Dynatrace collector) and using the filelogreceiver will achieve this:

<span class="pl-ent">receivers</span>:
  <span class="pl-ent">filelog</span>:
    <span class="pl-ent">include</span>: <span class="pl-s">[ c:\path\to\logs\*.log ]</span>