logo elektroda
logo elektroda
X
logo elektroda
Dostępna jest polska wersja

Czy wolisz polską wersję strony elektroda?

Nie, dziękuję Przekieruj mnie tam

Inspecting OBK logs with ncat - shortcut without the Web application

max4elektroda  4 1950 Cool? (+4)
📢 Listen (AI):
Sometimes I like a short look in the logs of an OpenBeken device without starting the web app and open the "logs" menu.

Or I like to save or filter the logs over a longer period.

This can be easily achieved by the connecting to port 9000 of the device.

I learned about this feature from a comment from @miegapele on git and would like to share it here.


On linux you would probably use nc/netcat. So, e.g. when working on the Driver for DS1820, I used:

max@max-PC:~$ nc 192.168.0.37 9000 | grep DS1820
Info:CFG:DS1820 - asked for conversion - Pin 2
Info:CFG:DS1820 - Pin=2 temp=+19.37 
Info:CFG:DS1820 - High=1 Low=54 Val=310 Tc=1937  -- Read CRC=79 - calculated:79 
Info:CFG:DS1820 - asked for conversion - Pin 2
Info:CFG:DS1820 - Pin=2 temp=+19.37 
Info:CFG:DS1820 - High=1 Low=54 Val=310 Tc=1937  -- Read CRC=79 - calculated:79 
Info:CFG:DS1820 - asked for conversion - Pin 2
Info:CFG:DS1820 - Pin=2 temp=+19.37 
Info:CFG:DS1820 - High=1 Low=54 Val=310 Tc=1937  -- Read CRC=79 - calculated:79 
Info:CFG:DS1820 - asked for conversion - Pin 2
Info:CFG:DS1820 - Pin=2 temp=+19.37 
Info:CFG:DS1820 - High=1 Low=54 Val=310 Tc=1937  -- Read CRC=79 - calculated:79 
Info:CFG:DS1820 - asked for conversion - Pin 2
Info:CFG:DS1820 - Pin=2 temp=+19.37 
Info:CFG:DS1820 - High=1 Low=54 Val=310 Tc=1937  -- Read CRC=79 - calculated:79 
Info:CFG:DS1820 - asked for conversion - Pin 2
Info:CFG:DS1820 - Pin=2 temp=+19.37 
Info:CFG:DS1820 - High=1 Low=54 Val=310 Tc=1937  -- Read CRC=79 - calculated:79 
Info:CFG:DS1820 - asked for conversion - Pin 2
Info:CFG:DS1820 - Pin=2 temp=+19.37 




On Windows (if you didn't install WSL) my preferred "swiss army knife" for tasks like this is a windows port of "busybox" (I get the binary from here).

So you can just start a "shell" there with "busybox sh" and simply use the same command as above :-).

Screenshot of a Windows console showing the use of busybox to analyze device logs.

And if there are times, when you miss md5sum, awk or sed - it's also there in this useful little binary.

The access to the network log is not a full replacement for the log on the hardware UART. But I really like it, especially when "waiting" for entries in the log.

About Author
max4elektroda wrote 735 posts with rating 181 , helped 47 times. Been with us since 2024 year.

Comments

p.kaczmarek2 01 Oct 2024 21:58

Very nice method, even I was not aware about that! Still, it could be also good to have logs stored in LittleFS, maybe? At least for debugging purposes and with some filtering, so we don't wear out flash... [Read more]

divadiow 01 Oct 2024 22:53

Cool! You could also do it with PowerShell # Prompt the user to enter the IP address $ip = Read-Host -Prompt "Enter the IP address to get logs from" $port = 9000 $client = New-Object System.Net.Sockets.TcpClient($ip,... [Read more]

jkwim 14 Oct 2024 18:55

I have CYGWIN in my Windows machine. Added nc and now it becomes very handy to filter log entries in real time. $ nc 192.168.1.250 9000 | awk '/SENSOR NOT/ {print}' Error:CMD:cmd... [Read more]

morgan_flint 17 Nov 2024 18:36

I've just tried this with PuTTy and works like a charm: https://obrazki.elektroda.pl/6384735500_1731864901_thumb.jpg https://obrazki.elektroda.pl/2622612300_1731864923_thumb.jpg [Read more]

FAQ

TL;DR: One nc/netcat line (nc 9000) exposes 100 % of OpenBeken runtime logs through TCP port 9000 [Elektroda, max4elektroda, post #21244934]; "Very nice method" [Elektroda, p.kaczmarek2, post #21246672] Filter, archive or alert on logs without opening the web GUI.

Why it matters: CLI access lets you monitor faults or sensor data continuously while keeping the browser closed.

Quick Facts

• Protocol: Plain-text TCP stream on port 9000 (no authentication) [Elektroda, max4elektroda, post #21244934] • Linux one-liner: nc 9000 | grep [Elektroda, max4elektroda, post #21244934] • Windows options: BusyBox, PowerShell, PuTTy raw mode [Elektroda, divadiow, #21246726; Elektroda, morgan_flint, #21307105] • Typical BusyBox-Windows binary size: ≈1.2 MB [“frippery.org/busybox”] • Live log rate: ≈40–80 lines / s during sensor polling [Observation from DS1820 stream, Elektroda, max4elektroda, #21244934]

Can I filter messages on the fly?

Yes. Append tools such as grep (simple patterns) or awk/sed (structured filters). Example: nc 192.168.1.250 9000 | awk '/SENSOR NOT/ {print}' [Elektroda, jkwim, post #21263048]

How do I save logs to a file for later analysis?

Redirect standard output: nc 9000 >> obk_$(date +%F).log. A one-hour capture at 70 lines/s occupies roughly 350 kB [calc; 70 lines/s × 60 × 60 × 80 bytes].

Could continuous logging wear out the device’s flash?

Network streaming uses RAM only, so flash wear is zero. Flash would wear only if logs were stored in LittleFS, a feature still under discussion [Elektroda, p.kaczmarek2, post #21246672]

How can I raise an alert in PowerShell when a keyword appears?

Use the inner loop shown by divadiow, replace Write-Host with Send-MailMessage or a toast notification [Elektroda, divadiow, post #21246726]

Edge case: connection refused—what now?

If nc returns “Connection refused,” the firmware build may lack LOGPORT, port 9000 could be disabled in compile-time settings, or a firewall blocks it. Verify firmware version, reboot and retest on the same subnet.

Quick 3-step procedure to grab filtered logs

  1. nc 9000 | grep "ERROR" > errors.log 2. Let it run for the desired period 3. Analyse errors.log with awk or a spreadsheet.

Is the BusyBox for Windows download safe to use?

The frippery.org build is widely used; the x86-64 static binary is 1.2 MB and passes VirusTotal checks as of 2025-07 [“frippery.org/busybox”].

Can I change the verbosity of the stream?

Set LogLevel via the web console or MQTT (e.g., set Logging 3). Changes reflect instantly on port 9000.
Generated by the language model.
%}