I need to display a program event log in dashboard

I need to display an event log for monitoring activity of the program. Is there such a tool or use Text ouput to display a continually growing list of entries which the program displays on a limited window? Is anyone doing something like this on the dashboard?

not exactly want you want but might lead you in thte direction you want to go.

Here is an example of a list of temperatures displayed in a table and they rotate thru the list

[{"id":"dc7f7bb3.197818","type":"inject","z":"968ca76f.3dc46","name":"Go","topic":"","payload":"1","payloadType":"str","repeat":"3","crontab":"","once":true,"onceDelay":"","x":90,"y":420,"wires":[["15fd4299.89d435"]]},{"id":"76978b4.ae88bf4","type":"function","z":"968ca76f.3dc46","name":"build array (1)","func":"var x = msg.payload.shift();\nmsg.payload.push(x);\nreturn msg;","outputs":1,"noerr":0,"x":440,"y":420,"wires":[["1d6198df.fef53f","6018b4d1.a55fb4"]]},{"id":"1d6198df.fef53f","type":"ui_template","z":"968ca76f.3dc46","group":"b8630066.5d446","name":"One dimension array table (temperature)","order":1,"width":"6","height":"6","format":"<table id=\"table\" border=\"1\">\n    <tr>\n        <th>Temperature</th> \n    </tr>\n    <tbody>\n        <tr ng-repeat=\"row in msg.payload\">\n            <td class=\"numeric\" >{{row}}</td>\n        </tr>\n    </tbody>\n</table>\n","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":720,"y":420,"wires":[["33f2bb1f.bb67cc"]]},{"id":"33f2bb1f.bb67cc","type":"debug","z":"968ca76f.3dc46","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":990,"y":420,"wires":[]},{"id":"fd309f5d.7262a8","type":"inject","z":"968ca76f.3dc46","name":"Go","topic":"","payload":"1","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"","x":90,"y":380,"wires":[["e88258a0.c4168"]]},{"id":"e88258a0.c4168","type":"function","z":"968ca76f.3dc46","name":"build array (1)","func":"var arr =[67.4, 69.5, 72.5, 67.8, 65.0];\nmsg.payload = arr;\nreturn msg;","outputs":1,"noerr":0,"x":260,"y":380,"wires":[["6018b4d1.a55fb4"]]},{"id":"6018b4d1.a55fb4","type":"change","z":"968ca76f.3dc46","name":"","rules":[{"t":"set","p":"array","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":690,"y":380,"wires":[[]]},{"id":"15fd4299.89d435","type":"change","z":"968ca76f.3dc46","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"array","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":260,"y":420,"wires":[["76978b4.ae88bf4"]]},{"id":"b8630066.5d446","type":"ui_group","z":"","name":"One dimension Array","tab":"f9ac9e91.20e588","order":1,"disp":true,"width":"6","collapse":false},{"id":"f9ac9e91.20e588","type":"ui_tab","z":"","name":"Table Examples","icon":"dashboard","order":1}]

It's kind of what I had in mind. I'm toying with logging the entries into a file and then reading the file into an array with a join. Then I was going to use an array pointer to position them in the log sort of like you have the temperatures here. I would like to read only the last entries in the file. It is not possible to only read the last 100 entries, or is it? then each row would be



The Tail node might be helpful.

Can you elaborate on that? I'll look it up.

I am not exactly certain how you would use it to do what you want, but it will give you new lines as they are written to the file, so if you manage some sort of FIFO rolling buffer that you display then that might do it.

You might find an old post of mine on the Flows site with an example of dumping a log to a dashboard, I think I posted it.

If you are using some type of *nix system, the simplest way to get the last 100 lines of a log file in reverse order (that I have used) is this command:

tac /path/to/file.log | head -100

The tac command (cat backwards) outputs the lines of the file in reverse order -- then the head command returns only the first N lines. If you can put that command into an exec node, then the output could be send to a ui_template node for rendering.

Is that the same result as
tail -n 100 /path/to/file
except that with tail they will be in the 'correct' order

Exactly... but I doubt any node-red function/flow to reverse the lines will be nearly as efficient

I’m using Windows 10 hosting Node-Red, by the way.

In that case I don't think you can use the tail node or the suggested commands (I may be wrong here though, and likely there are similar commands in Windows). I have already been chastised recently for suggesting the obvious solution to those finding problems running with Windows so I won't make that suggestion again.

I had assumed the window would be like a terminal with the latest at the bottom, so reversing would not be necessary. Perhaps that is not the requirement though. Anyway it seems that the server is Windows so a different set of commands will probably be necessary anyway.

Let’s rewind. Where are the log events coming from ? If inside Node-RED then no need to go out to a file and back ( apart from to store history).
Basic principle would be to use array push to add the new element to an array. Then check the length of the array and if larger than max required entries use shift to drop one off the other end. Or unshift and pop if you want build it the other way.

PS @colin. Here’s one for you https://www.forbes.com/sites/jasonevangelho/2018/07/19/ditching-windows-2-weeks-with-ubuntu-linux-on-the-dell-xps-13/

First, Thank you for your input. I'm attempting this project through Node-Red and I seem to be coming from the other side of the fence... Windows.

I am writing Warning and Error events to a Status Log File. I need to record the events anyway. The file reading was pursued to manage the lines. I was looking for any kind of NODE, or grouping of Nodes to do this kind of thing. I found something, it used the console output. I hadn't understood how to save it to file, or if was already stored to file as a log. How would I do that?

because I cannot read only the last say... 200 entries in the file, I may do as you suggest and keep the log array limited and post it directly. Then just update the file as necessary. I think I need some kind of message text box and it appears I have to construct it in a template with CSS and HTML. I can push it to another tab on the main page and display as wide as I need.

I was hoping someone had a need for what I'm looking at doing (generic for Windows or Linux).

I've done this trial with Ubuntu at work and I love it. My personal PC is going to be Ubuntu. My old Windows 7 laptop had a hardware problem and it will not start. I'm going to grab a refurbished laptop and load Ubuntu as soon as I get time.

can I look up the post in under your profile?

Yes, it is this one: https://flows.nodered.org/flow/b0fcb7b72fc05a30e55b

A bit old now, not sure if it will help but may give some ideas.

I had the same issue when I installing Ubuntu because I have window 7.and my touchpad not working when I go to hp touchpad not working they say me to install other versions. I have done as they give me guide.