I wanted to poll some ideas for a particular problem I have.
In the whole lot of machines I have at work, some of them keep their activity logs / data in databases (optimal), where as many of them just do so on text files.
From the machines that use text files for the activity logs, some of them keep them in rotating logs with the exact same name ( xxxxxxxxx.log, xxxxxxxxx.log.001, and so on), which is the best idea when working with logs.
However, there is a specific problem with some of the machines, which arbitrarily named files that are not consistent (-<batch_number>.log, for instance), sometimes dropped in the same folder, and sometimes with a consistent name, but put inside arbitrarily named folders (with the batch number, for instance).
Now, this might be fine if you are looking for a specific batch, or if you want to manually parse a specific file, but I was hoping to monitor the log files with tail and get (more or less) real time updates, but without knowing the file name (or path), it seems a tad difficult to do.
Is there any way I could monitor the latest file in a folder/subfolder and monitor that dynamically with the Tail node?
The other problem I see is that, if the file has already more than one line and I start monitoring then, I will only receive the new lines, so I should probably use a file node to parse anthing the file has at the beginning, and the tail node to monitor any new addition.
Or make my own rotation log file, locating the new logs and overwriting a single file in a known position? That might work for monitoring, but should I need a separate service for that, or could I do it in NR?