Overview
This node acts as a real-time file monitor that triggers workflows whenever new lines are appended to a specified file. It is particularly useful for scenarios such as monitoring log files, tracking live data feeds, or watching any text file that updates continuously. For example, it can be used to trigger alerts when specific events appear in server logs or to process streaming data from application output files.
Properties
Name | Meaning |
---|---|
Directory | Define the working directory path where the target file resides (e.g., /home/user/ ). |
File | Specify the filename within the directory to monitor for real-time updates (e.g., file.log ). |
Options | Collection of additional options: |
Last Lines | Number of last lines to load on startup before listening for new additions. Defaults to 0 (no initial lines loaded). |
Output
The node outputs JSON objects each time new lines are added to the monitored file. Each output item contains a single field:
line
: A string representing one line of text newly appended to the file.
The output is streamed line-by-line as new content appears in the file.
Dependencies
- Requires the
tail
command-line utility available in the system environment. - Uses Node.js child process spawning to run the
tail
command with parameters. - No external API keys or credentials are needed.
Troubleshooting
Common issues:
- The node depends on the presence of the
tail
command. If not installed or accessible, the node will fail. - Incorrect directory or file paths will cause the tail process to error out.
- Permissions issues may prevent reading the target file.
- The node depends on the presence of the
Error messages:
- Errors emitted from the
tail
process stderr are captured and emitted by the node. These typically indicate file access problems or invalid parameters. - To resolve, verify the directory and file exist and have appropriate read permissions.
- Ensure the
tail
utility is installed and available in the system PATH.
- Errors emitted from the