先日書いたエントリですが、
以下のようなコメントをいただきました。(Facebookでコメントいただいたので、お名前は隠しております)
およ、新規のノードがあるとは!確認を全くしていなかったので全然気がついていませんでした。 せっかくコメントを頂いたのでちゃんと動作するかも含めて確認しようと思います。
拡張ノードとしてtailノード
をインストールする
その他の拡張ノードと同様に最新版のNode-REDにnode-red-node-tail
をインストールしていきます。
右上の【三】メニューをクリックして、プルダウンから【パレットの管理】をクリック
【ノードの追加】タブをクリックして、検索ボックスにnode-red-node-tail
と入力していけば候補に表示されるので、【ノードの追加】ボタンをクリックすると
確認のダイアログが表示されるので【追加】ボタンをクリックするとインストールが行われます。
インストール完了のダイアログが表示されます。
インストール後は旧バージョンと同様にStorageカテゴリにtailノード
が表示されます。
動作を確認
プロパティの内容を確認しましたが、旧バージョンにもあったパラメータがそのままあります。
旧バージョンで保存したフローを新バージョンのNode-REDに読み込んで実行してみましたが問題なく動作しました。
フロー
動作結果
テストに使用したフローは末尾につけておきました。
そのまま動作してくれるのでわざわざfunctionノード
で作成しなくても良かった…勉強になったので良かったですが。
以前は気にしていなかったのですが、今回の実験でノードの名前がtailノード
となっていますが、処理の内容的には、監視しているファイルに追記された行を順次出力してくれるという機能のほうが近いのかなと思いました。(差分のみの行出力をしてくれるの意)このほうが汎用的な処理がかけるかなとも思います。
おわりに
Node-REDはちゃんと機能を担保してれていると分かって、サポートがバッサリ切られるということはないんですね。 勉強になるとともに、助かるわ~という認識に至りました。
今後は標準ノードからなくなってしまっても、一旦は探したほうがいいですね。車輪の再開発にならないためにも。
ということで、tailノード
は標準ノードという位置づけからは消えましたが、ちゃんと動きますよというお話でした。
テストに使用したフロー
[ { "id": "73755b41.2fb194", "type": "tab", "label": "フロー 1", "disabled": false, "info": "" }, { "id": "8efbb7be.484168", "type": "file", "z": "73755b41.2fb194", "name": "", "filename": "log.txt", "appendNewline": true, "createDir": true, "overwriteFile": "false", "encoding": "none", "x": 350, "y": 60, "wires": [ [ "bf4784e6.89b858", "af98e3bb.03ed2" ] ] }, { "id": "ea2bd64e.fd74b8", "type": "inject", "z": "73755b41.2fb194", "name": "", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "topic": "", "payload": "", "payloadType": "date", "x": 180, "y": 60, "wires": [ [ "8efbb7be.484168" ] ] }, { "id": "bf4784e6.89b858", "type": "debug", "z": "73755b41.2fb194", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "x": 590, "y": 60, "wires": [] }, { "id": "4cc468c6.af0f38", "type": "tail", "z": "73755b41.2fb194", "name": "", "filetype": "text", "split": "[\\r]{0,1}\\n", "filename": "log.txt", "inputs": 0, "x": 150, "y": 240, "wires": [ [ "9ac418a8.b1ac88", "5eac837e7bacedf5" ] ] }, { "id": "af98e3bb.03ed2", "type": "file in", "z": "73755b41.2fb194", "name": "", "filename": "log.txt", "format": "stream", "chunk": false, "sendError": false, "encoding": "none", "allProps": false, "x": 570, "y": 120, "wires": [ [ "1cd01b79.2b76e5", "ecdb5c39.c30f" ] ] }, { "id": "1cd01b79.2b76e5", "type": "debug", "z": "73755b41.2fb194", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "filename", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 830, "y": 120, "wires": [] }, { "id": "ecdb5c39.c30f", "type": "debug", "z": "73755b41.2fb194", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "targetType": "msg", "statusVal": "", "statusType": "auto", "x": 830, "y": 160, "wires": [] }, { "id": "1b98bb88.57ac54", "type": "watch", "z": "73755b41.2fb194", "name": "", "files": "log.txt", "recursive": "", "x": 150, "y": 180, "wires": [ [ "65ac1c17.f7afe4" ] ] }, { "id": "65ac1c17.f7afe4", "type": "template", "z": "73755b41.2fb194", "name": "", "field": "payload", "fieldType": "msg", "format": "handlebars", "syntax": "mustache", "template": "ファイルが変更されました。", "output": "str", "x": 380, "y": 180, "wires": [ [ "72c42a7549c9e750" ] ] }, { "id": "9ac418a8.b1ac88", "type": "template", "z": "73755b41.2fb194", "name": "", "field": "payload", "fieldType": "msg", "format": "handlebars", "syntax": "mustache", "template": "対象ファイルの末尾が変更されました。", "output": "str", "x": 380, "y": 240, "wires": [ [ "72c42a7549c9e750" ] ] }, { "id": "72c42a7549c9e750", "type": "debug", "z": "73755b41.2fb194", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 590, "y": 180, "wires": [] }, { "id": "5eac837e7bacedf5", "type": "debug", "z": "73755b41.2fb194", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "false", "statusVal": "", "statusType": "auto", "x": 300, "y": 320, "wires": [] } ]