Node-RED File Tail Node

raw JSON →
0.4.0 verified Thu Apr 23 auth: no javascript maintenance

The `node-red-node-tail` package provides a core Node-RED node designed to monitor and process changes in files on the local filesystem. It functions similarly to the `tail -f` command, continuously reading and injecting new lines appended to a specified file directly into a Node-RED flow. This enables real-time processing of log files, data streams, or any continuously updated text files within a Node-RED environment. The latest stable version, 0.4.0, was published over three years ago, indicating that this specific node is currently in a maintenance phase rather than active development. While part of the broader `node-red-nodes` collection, its release cadence is irregular, tied to Node-RED's own lifecycle or specific bug fixes rather than a frequent update schedule. Its primary differentiator is its seamless integration into the Node-RED visual programming paradigm, allowing users to configure file monitoring without writing any code, solely through the editor UI.

error Error: EACCES: permission denied, open '/path/to/logfile.log'
cause The Node-RED process does not have sufficient read permissions for the specified file.
fix
Ensure the user running Node-RED has read access to the file. For example, sudo chmod +r /path/to/logfile.log or adjust file ownership to the Node-RED user.
error TypeError: Cannot read properties of undefined (reading 'split')
cause This error can occur if the 'tail' node receives a non-string input or if the file content is unexpectedly malformed when processing lines.
fix
Verify that the file being tailed contains expected text data. If feeding dynamic paths, ensure the msg.filename property passed to the node always contains a valid string path.
error Error: ENOENT: no such file or directory, open '/path/to/nonexistent/file.log'
cause The configured file path for the 'tail' node points to a file that does not exist on the filesystem.
fix
Double-check the file path configured in the 'tail' node's properties. Ensure the file exists at that exact location on the server where Node-RED is running.
gotcha File permissions are critical. The Node-RED process (and thus the tail node) must have read access to the specified file and its parent directories. Lack of permissions will result in errors and the node failing to read the file.
fix Ensure the Node-RED user has appropriate read permissions (e.g., `sudo chmod +r /var/log/syslog` or adjust user/group ownership) for the target file.
gotcha Monitoring very large files with extremely high write rates might impact Node-RED's performance due to continuous I/O and message processing. Consider filtering at the source or rate-limiting within the flow for high-volume logs.
fix For high-volume scenarios, implement additional filtering nodes downstream (e.g., `switch` node) or consider external log processing tools before feeding into Node-RED. Optimize file access and ensure sufficient system resources.
breaking The latest version of this node (0.4.0) was published 3 years ago. While generally functional, it may not be fully compatible with the absolute latest Node-RED runtime versions (e.g., 4.x and above) or newer Node.js LTS versions, potentially leading to unforeseen issues or deprecated API usage.
fix Test thoroughly with your specific Node-RED and Node.js versions. If issues arise, check the Node-RED forums or GitHub issues for similar reports. Consider using a more actively maintained `node-red-contrib-tail-file` package if official support is critical.
npm install node-red-node-tail
yarn add node-red-node-tail
pnpm add node-red-node-tail

This Node-RED flow demonstrates how to install and configure the 'tail' node to monitor a system log file (e.g., /var/log/syslog) and output new lines to the debug sidebar.

[{"id":"a1b2c3d4e5f6g7h8","type":"tail","name":"Tail syslog","file":"/var/log/syslog","delay":"0","format":"lines","x":120,"y":100,"wires":[["n1"]]},{"id":"n1","type":"debug","name":"Log Output","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"currentPayload","statusType":"auto","x":340,"y":100,"wires":[]}]