Logging, Syslog or HTTP
-
I would like to connect my Printer (Duet2E) to my splunk instance.
At the moment I have to pull the logs via ftp every minute. That is neither elegant nor real-time.I know, there is rr_status, but that is also pull and not push.
I would like the reprap-firmware to push the events via Syslog or http(s) to my splunk instance.
Especially push via http(s) is modern and easy, it is nothing more than a JSON-blob in a http-request:
curl -k -u "x:CF179AE4-3C99-45F5-A7CC-3284AA91CF67" "https://mysplunkserver.example.com:8088/services/collector/event" \ -d '{"sourcetype": "mysourcetype", "event": "Hello, world!"}'
where
CF179AE4-3C99-45F5-A7CC-3284AA91CF67
is some authentication-token.Furthermore http(s) and syslog are not only relevant for splunk but also for other logging platforms. For Example collectd also uses http(s) to send logevents.
-
AFAIK there is currently no functionality in RepRapFirmware to open outgoing HTTP or TCP connections, let alone "running a simple curl command" directly from the microcontroller. I would be surprised if there is enough computational power to handle TLS, and a full TCP stack - while also doing an actual print at the same time. You might be able to offload the TCP heavy-lifting to the ESP or Ethernet module...
If you are running a Duet3 with a SBC - then of course you can run something on the SBC.
-
closest you'll get is M118, which a connected telnet client can listen for.
or with rrf 3.2 you can also use a raspberry pi with duet 2, just like duet 3, and use the pi to run a shell script from g-code f.ex.
-
@bearer said in Logging, Syslog or HTTP:
or with rrf 3.2 you can also use a raspberry pi with duet 2, just like duet 3, and use the pi to run a shell script from g-code f.ex.
That really sounds very (very!) good. Can't wait for it.
But how is this going to work in detail? I read (well, okay: skim-read) the readme from dsf. According to this we have
- DuetControlServer
- DuetWebServer
- Tools (?)
As far as I can tell the DuetControl Server looks most promising, but where does it write its logs? Just to default system log? If not where?
Does this log differ anyhow from the log one can create withM929
? -
this is probably by far the simplest approach https://forum.duet3d.com/topic/13194/dsf-extension-exec-on-mcode-was-shutdown-sbc
-
@bearer said in Logging, Syslog or HTTP:
this is probably by far the simplest approach https://forum.duet3d.com/topic/13194/dsf-extension-exec-on-mcode-was-shutdown-sbc
So your idea is that I do something like this?
M2342 F"my log message"
Yes this is a nice option to have for custom log messages, but actually I was after system logs. Something like:
- system started, RRF Version 3.2.xx
- heater 0 configured
- network initiated: got ip 12.34.56.78 via DHCP-server at 12.34.56.1
- User $username logged in via webinterface from 12.34.56.23
- leveling started from PanelDue
- leveling done
- homing successfull
- ran macro "load-filament.g"
- started job: "myprintjob.g"
- error: heater fault on heater N
- canceled(/stopped/resumed) job "myprintjob.g" for reason X after HH:MM:SS
- [...]
That should go to some default log-file automatically, doesn't it?