Relevance statement for checking if there are changes in a text/csv file

Hello team,

I just want to know if you have a recommendation on the best way on how to check if there would be any changes on a text file. There is a text file that will contain the Computer Name and IP Address of the machine and it is expected that the text file would increase it’s line if a new machine is registered and the lines can also change due to the change of IP address.

This relevance statement will be used in trigerring a policy.

Thanks in advance for any feedback.

One way would be to compare the modification time of the file to the last time the action was run. This piece of relevance should make the Fixlet always relevant, but once it’s triggered as an Action it only runs once each time the file is modified:

exists file "c:\my-info-file.txt" and not exists (last active time of action) whose (it > modification time of file "c:\my-info-file.txt")

Otherwise, if you also want the Fixlet itself to only be relevant when the file has been modified, you could update a client setting each time you parse the file:

Action:

<do something to parse the file>
setting "I-last-parsed-the-file"="{now}" on "{now}" for client

Relevance:

not exists setting "I-last-parsed-the-file" whose (value of it as time > modification time of file "c:\my-info-file.txt") of client

This is one of the rare cases when setting the effective time of the setting to "{now}" is likely to be better than "{parameter "action issue date" of action}", because you expect a Policy Action will update the setting repeatedly over time.

1 Like

Ah yes, pointing to the modification time of the file would be a very nice idea. And thank you for the relevance statement. I will give that a try :slight_smile: