The FKM setup would be as follows:
Select the “dynamicFiles” drop-down option under Source.
Click the “Dynamic files…” button which opens the Dynamic files window as seen below:
In the Path field, put the complete file path and use the today function followed by *.log.
This allows the FKM sampler to automatically monitor files in the folder with today’s date on it.
In the Regex field put the following Regex expression:
^.*Logs\/\d+-\d+-\d+\/(.*)-\d+.log$
For the FKM sampler to grab the latest version of each file in the directory, the regex expression needs to be unique.
We do that by including the Logs\/ sub-folder in the regex expression since the Logs sub-folder will remain the same.
Followed by the pattern for the date folder:
\d+\d+\d+\/
We have a capture group (.*) in the expression that will hold a portion of the filename up until the dash (-) number portion dot (.) log. The capture group is used in the name column of the dataview.
The following -\d+ ensures we consider the last dash in the filename followed by the number.
The .log at the end will apply only to files with that file extension.
Below is the Metrics view of the FKM sampler displaying Prod_ProcessA-13.log, Prod_ProcessB-13.log, and Prod_ProcessC-13.log files.
Use date generation function when using dynamic files option
Attached is the "FKM - dynamic example" sampler. Please note this sampler was set up on version GA5.9.0.
Comments
0 comments
Please sign in to leave a comment.