Node-red-log Data Export

How do I pull data from the msg.payload: string. See below for the Data. I need to separate Address and value as a single message and deviceid as a secound message.

msg : Object
object
payload: string
deviceId----------> 55
maxApdu----------> 1476
segmentation----------> 0
vendorId----------> 7
object type----------> 7
vendorId----------> 7
pi : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/usr/bin/node-red-log 1
pam_unix(sudo:session): session opened for user root by (uid=0)
root : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/bin/journalctl -f -n 25 -u nodered -o cat
pam_unix(sudo:session): session opened for user root by (uid=0)
1 Oct 14:08:37 - [info] Stopping flows
1 Oct 14:08:37 - [info] Stopped flows
1 Oct 14:08:37 - [info] Starting flows
1 Oct 14:08:39 - [info] Started flows
address----------> 192.168.251.55
deviceId----------> 55
maxApdu----------> 1476
segmentation----------> 0
vendorId----------> 7
object type----------> 7
vendorId----------> 7
pi : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/usr/bin/node-red-log 1
pam_unix(sudo:session): session opened for user root by (uid=0)
root : TTY=unknown ; PWD=/home/pi ; ...
socketid: "7E5dLH4WdG_0NLzKAAAA"
_msgid: "1967fb07.660f45"

[{"id":"3e21ca48.bc8856","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"ed77903a.c80f6","type":"function","z":"3e21ca48.bc8856","name":"","func":"//var msg = {};\nconst bacnet1 = global.get('bacnet');\n// Initialize BACStack\nvar client = bacnet1({adpuTimeout: 6000});\n\nclient.whoIs();\n\nclient.on('iAm', (device) => {\n  console.log('address: ', device.address, ' - deviceId: ', device.deviceId, ' - maxAdpu: ', device.maxAdpu, ' - segmentation: ', device.segmentation, ' - vendorId: ', device.vendorId);\n});\n","outputs":1,"noerr":0,"x":450,"y":300,"wires":[["b11cacc4.e421a"]]},{"id":"b11cacc4.e421a","type":"debug","z":"3e21ca48.bc8856","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":670,"y":240,"wires":[]},{"id":"35eea2d3.d571be","type":"ui_button","z":"3e21ca48.bc8856","name":"","group":"4eb4d82b.900068","order":1,"width":0,"height":0,"passthru":false,"label":"BACnet Whois T","tooltip":"","color":"red","bgcolor":"","icon":"","payload":"1","payloadType":"num","topic":"","x":220,"y":300,"wires":[["ed77903a.c80f6","66650a75.6851e4"]]},{"id":"6ee62fd4.b9e13","type":"ui_text","z":"3e21ca48.bc8856","group":"4eb4d82b.900068","order":3,"width":"10","height":"21","name":"Whois results","label":"Whois results T","format":"{{msg.payload}}","layout":"col-center","x":1160,"y":360,"wires":[]},{"id":"32e450d4.a6fc4","type":"exec","z":"3e21ca48.bc8856","command":"sudo node-red-log ","addpay":true,"append":"","useSpawn":"true","timer":"","oldrc":false,"name":"Whois results","x":660,"y":420,"wires":[["d0c50508.b826d8","db3e4132.31dbe"],[],[]]},{"id":"66650a75.6851e4","type":"delay","z":"3e21ca48.bc8856","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":460,"y":420,"wires":[["32e450d4.a6fc4"]]},{"id":"d0c50508.b826d8","type":"debug","z":"3e21ca48.bc8856","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":830,"y":300,"wires":[]},{"id":"a5ac1c26.72e45","type":"debug","z":"3e21ca48.bc8856","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1150,"y":420,"wires":[]},{"id":"e794f126.14103","type":"ui_button","z":"3e21ca48.bc8856","name":"","group":"4eb4d82b.900068","order":2,"width":0,"height":0,"passthru":false,"label":"Clear Results T","tooltip":"","color":"red","bgcolor":"","icon":"","payload":"Results Cleared","payloadType":"str","topic":"","x":220,"y":360,"wires":[["6ee62fd4.b9e13"]]},{"id":"db3e4132.31dbe","type":"sort","z":"3e21ca48.bc8856","name":"","order":"ascending","as_num":true,"target":"payload","targetType":"msg","msgKey":"","msgKeyType":"elem","seqKey":"payload","seqKeyType":"msg","x":930,"y":420,"wires":[["a5ac1c26.72e45"]]},{"id":"4eb4d82b.900068","type":"ui_group","z":"","name":"Whois","tab":"99082a6.ab01ed8","order":1,"disp":true,"width":10,"collapse":true},{"id":"99082a6.ab01ed8","type":"ui_tab","z":"","name":"Testing","icon":"dashboard","disabled":false,"hidden":false}]

Unfortunately your flow isn't currently importable.Please read the following post How to share code or flow json and then edit the above message.

But take a look at the javascript split command https://www.w3schools.com/jsref/jsref_split.asp

Does the above help?

Could you read the post @ukmoose linked to and edit your post and retry

Fixed. Sorry about that.

Ok we cannot run your flow as we don't have your equipment/nodes (bacnet)

But you are using console.log - does this work ? Recommended is node.log("x");
Next you are using sudo in your exec node - does that work ?

Can you paste a browser debug output here ?

Everything works great. the output from my Exec node is below. the information from the output has the data I want.
node.log broke the flows it keeps restarting when trying that route.

this information is what Iwant "address: 192.168.251.55 - deviceId: 55 - maxAdpu: undefined - segmentation: 0 - vendorId: 7"

msg : Object
object
payload: string
1 Oct 15:32:52 - [info] Starting flows
1 Oct 15:32:53 - [info] Started flows
address: 192.168.251.55 - deviceId: 55 - maxAdpu: undefined - segmentation: 0 - vendorId: 7
pi : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/usr/bin/node-red-log 1
pam_unix(sudo:session): session opened for user root by (uid=0)
root : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/bin/journalctl -f -n 25 -u nodered -o cat
pam_unix(sudo:session): session opened for user root by (uid=0)
1 Oct 15:36:44 - [info] Stopping flows
1 Oct 15:36:44 - [info] Stopped flows
1 Oct 15:36:44 - [info] Starting flows
1 Oct 15:36:45 - [info] Started flows
address: 192.168.251.55 - deviceId: 55 - maxAdpu: undefined - segmentation: 0 - vendorId: 7
pi : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/usr/bin/node-red-log 1
pam_unix(sudo:session): session opened for user root by (uid=0)
root : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/bin/journalctl -f -n 25 -u nodered -o cat
p...
socketid: "7E5dLH4WdG_0NLzKAAAA"
_msgid: "fdb55694.42c2b8"

I would love the output to be msg.Address = value, msg.Deviceid = value and so fourth.

This is not the output from the browser but from the console.

correct, I do not have an output from a browser. I am sorry if I am misunderstanding what you are wanting.

Where does the data come from ? It is a node right ?
Then you can connect a debug node.

Does it output a string, an array, an object ?

I hope this helps the data after I press the button is to the right. From that data i want to extract only Address and DeviceID and the values next to them.

And now in text please, so that we can possibly help parsing it. and enclose it in ```

root : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/bin/journalctl -f -n 25 -u nodered -o catpam_unix(sudo:session): session opened for user root by (uid=0)1 Oct 16:30:30 - [info] Stopping flows1 Oct 16:30:30 - [info] Stopped flows1 Oct 16:30:30 - [info] Starting flows1 Oct 16:30:32 - [info] Started flowsaddress: 192.168.251.55 - deviceId: 55 - maxAdpu: undefined - segmentation: 0 - vendorId: 7 pi : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/usr/bin/node-red-log 1pam_unix(sudo:session): session opened for user root by (uid=0) root : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/bin/journalctl -f -n 25 -u nodered -o catpam_unix(sudo:session): session opened for user root by (uid=0)address: 192.168.251.55 - deviceId: 55 - maxAdpu: undefined - segmentation: 0 - vendorId: 7 pi : TTY=unknown ; PWD=/home/pi ; USER=root ; COMMAND=/usr/bin/node-red-log 1pam_unix(sudo:session): session opened for user root by (uid=0) root : TTY...

and enclose it in ```

Else the formatting is gone (ie: like you did before)

But i am confused why you want to read the node-red-log, don't you get this information from the nodes you are using ?

I am not using any nodes to get the data. I have a function that runs the Whois that writes the data to the console.
I have the Exe node that pulls the data from the console.

So why do you need to read the log as you already have it in a function ?
Sorry I am really confused.

send the data to a split node and split it on a new line
feed that output to a switch and set a 'contans' and use 'address'
feed that to a split node that splits on a dash ("-")
feed that into a switch node with tw conditions - both using 'contains' the first checks for "address" and the second checks for "deviceId"

and you have what you are looking for.

@zenofmud Thank you so much! I used the split before and the split but didn't think to combine the 2 to get what I needed!