# File truncated message

**URL:** https://discourse.nodered.org/t/file-truncated-message/5223
**Category:** General
**Created:** [27 November 2018 00:02 UTC](https://discourse.nodered.org/t/file-truncated-message/5223 "2018-11-27T00:02:48Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![tristan](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@tristan](https://discourse.nodered.org/u/tristan)
#### Post date: [27 November 2018 00:02 UTC](https://discourse.nodered.org/t/file-truncated-message/5223/1 "2018-11-27T00:02:48Z")

</div>

Hi there, I'm new to this forum and new to node-red. I have a Raspberry Pi 3 B+ with node-red server running. I have a simple flow set up where tail watches a file for updates and sends a simple message to a gauge. The gauge updates when file updates but I get this message - tail: /dev/shm/pressure: file truncated - in debug window. The file holds a short string such as '19.3'. This is my "hello world" test - need a little help to get it over the finish line. Any guidance will be appreciated.

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [27 November 2018 00:38 UTC](https://discourse.nodered.org/t/file-truncated-message/5223/2 "2018-11-27T00:38:57Z")

</div>

Let me be the first to welcome to the world of Node-Red! 🎇

Now when opening a thread it is a good idea to name your platform (which you did!) what release of NR and node.js you are on (if you run NR with a `node-red-start` command in a terminal, you will see both releases at the start of the log)

And in a case like this, providing your flow would b useful (select export to clipboard, copy it and in the thread start with three back tic's ``` on a line, then paste the flow and on the next line put in three more back tics.

I't nice to see you are already using the debug node and I (and many othters) will be happy to guide you along

---

<div class="post-metadata">

### Author: ![tristan](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@tristan](https://discourse.nodered.org/u/tristan)
#### Post date: [27 November 2018 01:12 UTC](https://discourse.nodered.org/t/file-truncated-message/5223/3 "2018-11-27T01:12:19Z")

</div>

Thanks for the welcome and the reminder,

Node.js version: v8.12.0  
Node-RED version: v0.19.5  
Linux 4.14.79-v7+ arm LE

```auto
[{"id":"c64b31f0.ee667","type":"ui_gauge","z":"10bb1299.024e2d","name":"Flow Rate","group":"351aad56.0170ca","order":1,"width":0,"height":0,"gtype":"gage","title":"Flow Rate","label":"gpm","format":"{{value}}","min":0,"max":"20","colors":["#ca3838","#e6e600","#00ca06"],"seg1":"7","seg2":"14","x":580,"y":80,"wires":[]},{"id":"57ac8cce.a0ca44","type":"tail","z":"10bb1299.024e2d","name":"read file flow-rate","filetype":"text","split":false,"filename":"/home/pi/Juicer/flow-rate","x":180,"y":80,"wires":[["c64b31f0.ee667","70b1ce7.01fa6b"]]},{"id":"70b1ce7.01fa6b","type":"debug","z":"10bb1299.024e2d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":570,"y":120,"wires":[]},{"id":"351aad56.0170ca","type":"ui_group","z":"","name":"WRL Dashboard","tab":"afe8a68a.3c0a78","order":3,"disp":true,"width":"6","collapse":false},{"id":"afe8a68a.3c0a78","type":"ui_tab","z":"","name":"Main Tab","icon":"dashboard","order":1}]

```

The message does not seem to be generated by the debug node. I get the message with or without debug node.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [27 November 2018 08:40 UTC](https://discourse.nodered.org/t/file-truncated-message/5223/4 "2018-11-27T08:40:21Z")

</div>

> [@tristan](#):
>
> tail watches a file for updates and sends a simple message to a gauge.

Tail is designed to watch a file that is being added to. If you use it for a file that is completely overwritten each time then it gets confused. Try this in a terminal  
`echo " " > temp.txt`  
then open another terminal and run  
`tail -f temp.txt`  
back in the first terminal  
`echo "hello " >> temp.txt`  
which appends to the file, so it appears in the tail window. Then, in the first terminal again  
`echo "hello again" > temp.txt`  
which overwrites the file, and you will see the truncated message from tail.  
Instead of the Tail node you can use the Watch node, which will tell you when the file is written to. When it gets written to then use a File In node to fetch the value.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [27 November 2018 08:53 UTC](https://discourse.nodered.org/t/file-truncated-message/5223/5 "2018-11-27T08:53:39Z")

</div>

Alternatively see if your version of tail has -F (capital) option which checks to see if the file has be "rotated" ie removed/replaced by a new one of same name.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [27 November 2018 09:00 UTC](https://discourse.nodered.org/t/file-truncated-message/5223/6 "2018-11-27T09:00:16Z")

</div>

I believe the Tail node already uses -F, I don't think that stops it showing the truncated message.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [27 November 2018 09:02 UTC](https://discourse.nodered.org/t/file-truncated-message/5223/7 "2018-11-27T09:02:35Z")

</div>

@tristan you can just ignore the message if you like, I believe the tail will still work correctly.

---

<div class="post-metadata">

### Author: ![tristan](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@tristan](https://discourse.nodered.org/u/tristan)
#### Post date: [27 November 2018 17:37 UTC](https://discourse.nodered.org/t/file-truncated-message/5223/8 "2018-11-27T17:37:42Z")

</div>

Thanks for responding. I was using the Tail node incorrectly - it seems to work without error when files are appended to not rewritten. I have taken Colin's advice and use the Watch and File nodes together. With Node-RED and help from this forum I'm solving some long-standing problems quickly. Thanks again.
