Reduce log size (syslog)

Hi, thanks for your kind attention,
the TCP node is logging too much in my case, I?ve a device that closes the connection after some times and it attempts to reconnect. I would limit the writes on SD card on Pi3 so I have this questions:
May I exclude/filter out TCP node from logging?
Can I exclude NR from logging into syslog? I would keep it for other events, but in case..

I also have daemon.log and lastolog files whic are full of zeros and around 1MB, I don't know from what they depending on, it's possible to reduce them too?
Thank you for help )

How many bytes per day are you logging? Modern SD cards are rarely affected by writing too much data. Provided you use a good quality card from a reputable supplier it is most unlikely that you will have a problem.

thanks for answer, not really many, but I got already 2 failures with modern SD, maybe my mistakes but I'm careful and want to reduce problems.
If there is notheing to do about TCP logs/stops logs I'll try to find another way..

That is a completely meaningless answer.
Unless you are writing many tens of MB/day then don't worry at all. In fact you probably don't need to worry unless you are writing hundreds of MB/day.

I've asked log2ram and it's impossibile to filter out something with that program. I have 2 chances I guess, ask here to add the TCP node the option to don't log connections (who is the author?) or find a script that opens syslog and pure it out those lines..
Thank you for your kind support )

How big is your syslog/day and what proportion of that is coming from the TCP node?

it's about 500K and TCP message will fill it up 98%.. disable them will be a miracle )

Show us some of the messages the TCP node is logging.

Aug  4 18:16:58 RaspbFranco Node-RED[354]: 4 Aug 18:16:58 - [info] [tcp out:Dimmer WiFi Bridge] connection lost to 192.168.1.254:8899
Aug  4 18:17:01 RaspbFranco CRON[19553]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Aug  4 18:17:08 RaspbFranco Node-RED[354]: 4 Aug 18:17:08 - [info] [tcp out:Dimmer WiFi Bridge1] connecting to 192.168.1.254:8899
Aug  4 18:17:08 RaspbFranco Node-RED[354]: 4 Aug 18:17:08 - [info] [tcp out:Dimmer WiFi Bridge1] connected to 192.168.1.254:8899
Aug  4 18:21:12 RaspbFranco Node-RED[354]: 4 Aug 18:21:12 - [info] [tcp out:Dimmer WiFi Bridge2] connection lost to 192.168.1.253:8899
Aug  4 18:21:22 RaspbFranco Node-RED[354]: 4 Aug 18:21:22 - [info] [tcp out:Dimmer WiFi Bridge2] connecting to 192.168.1.253:8899
Aug  4 18:21:22 RaspbFranco Node-RED[354]: 4 Aug 18:21:22 - [info] [tcp out:Dimmer WiFi Bridge2] connected to 192.168.1.253:8899
Aug  4 18:22:08 RaspbFranco Node-RED[354]: 4 Aug 18:22:08 - [info] [tcp out:Dimmer WiFi Bridge1] connection lost to 192.168.1.254:8899
Aug  4 18:22:18 RaspbFranco Node-RED[354]: 4 Aug 18:22:18 - [info] [tcp out:Dimmer WiFi Bridge1] connecting to 192.168.1.254:8899
Aug  4 18:22:18 RaspbFranco Node-RED[354]: 4 Aug 18:22:18 - [info] [tcp out:Dimmer WiFi Bridge1] connected to 192.168.1.254:8899

Quick fix, comment out lines 70, 76 & 131 from file 31-tcpin.js most likely in /usr/lib/node_modules/node-red/node_modules/@node-red/nodes/core/network

looks a great suggestion! thanks.
After this is just it necessary to restart NR?

Why does it keep losing the connection, or is that intentional?

Yes you will need to restart to pick up the changes.

But as @Colin asks, why does the connection keep getting dropped, it would be better to fix the real cause of the problem.

Or maybe try the tcp-request node. I’m sure that can automatically close the connection after sending without logging.

Thanks everyone for help :slight_smile:
Unfortunately it depends on the WiFi bridge for dimmers, it's made for receving connection from the phone app, probably because of this there is no need to keep the connection opened and drain battery of the mobile. I've sniffed the traffic and I reproduced the app on Node Red function, to manage the dimmers. For me it's important to keep the connection opened as long as possibile, so when a command should be sent there will be chances to transmit it to dimmers immediately.

works thanks :slight_smile:
Question: will it keep the modification? Or if I update NR it will be overwritten?

It will get overwritten on upgrades to the core.

ok, by the way now I know where and what to comment out :slight_smile:

I would still suggest trying the tcp-request node as that will open send (optionally wait for reply) and then close the connection without logging anything

I will give a try, thank you :slight_smile:
The problem is that experimenting on a "closed tecnology" (they not suppose somebody else use it) may create faults, it it works unexpectely. If the bridge suppose that connection still open, while receiving a burst of packages when regulating brightness for example, open and close may result as a flood for it.
In the beginning I do remember how I got crazy when I cloned unproperly and I trasmitted too many packets, resulting on a brick of dimmer, and reset it was really a mission )