ESP32 Console logging to Grafana
maxdd opened this issue · comments
Hello,
I was wondering whether there is a proper way to send "log text" to influxdb so that it can be used e.g. from a "log panel" to display debugging log messages.
The intention for me is to have a sort of uart over grafana or soem sort of "analytics" feature in ESP32.
For example is it sufficient to create a string containing all the information similarly to this picture?
https://grafana.com/static/img/docs/explore/navigate-logs-8-0.png
e.g.
String t = "level=warn msg=\"Setting xyz in function abc\" other=\"you name it\" ID=2849"
//How to do i write raw from a string to influxdb??
or is it better to use e.g.
console.clearFields();
console.addField("level", "warn"); //with or without ""
console.addField("msg", "Setting xyz in function abc");
console.addField("other", "you name it");
console.addField("ID", AppID);
if (!client.writePoint(sensor)) {
Serial.print("InfluxDB write failed: ");
Serial.println(client.getLastErrorMessage());
}
Can i achieve what i'm looking for in this way?
Of course once the backbone is set i would wrap it around e.g.
Console.write(WARN, AppID, Setting xyz in function abc, ...);
Regards,
This could help you: https://www.influxdata.com/blog/writing-logs-directly-to-influxdb