I noticed there is a new item coming called vfs.file.contents[]. I was just needing this the other day! I have a trigger for when a log file size increases and I wanted to have a simple way to include the last couple lines (or just the last line) of the file in the action message.
It would be neat if vfs.file.contents[] had some arguments for mode and lines. For example, default could be vfs.file.contents[<file>,<encoding>,<mode>,<lines>] where mode is 'all' by default. Mode could also be something like 'head' or 'tail' and then <lines> could specify the number of lines to gather.
This would be useful when triggering on a size increase of a file to include the last line of the file in the action message using item vfs.file.contents[/var/log/my_log_file,utf8,tail,1] to get the last line of the file triggering. Hope someone else may have interest in this also
It would be neat if vfs.file.contents[] had some arguments for mode and lines. For example, default could be vfs.file.contents[<file>,<encoding>,<mode>,<lines>] where mode is 'all' by default. Mode could also be something like 'head' or 'tail' and then <lines> could specify the number of lines to gather.
This would be useful when triggering on a size increase of a file to include the last line of the file in the action message using item vfs.file.contents[/var/log/my_log_file,utf8,tail,1] to get the last line of the file triggering. Hope someone else may have interest in this also
Comment