crude idea for log storage/retrieval

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

crude idea for log storage/retrieval

Postby mzimmers » Wed Dec 04, 2019 6:48 pm

Hi all -

I need to start storing log messages. It would be nice if I could store ~1000 messages of up to ~100 characters each. I've already done all the work involved in routing ESP_LOG* though my own function, so now I just need a means of storing them. I was thinking of using a namespace in NVS, and store them as key value pairs. The keys would be like LOG_NNN, and I'd maintain a variable that denoted the last used value. Once I reached the limit (of 999) I'd start over, to emulate a crude ring buffer.

Before I dive into this, I just wanted to get a sense from people as to whether this idea was good/so-so/terrible. I don't think I will need to be terribly efficient (most of the time, there will just be one message every few minutes of operation, though there will be occasional bursts when a handful of messages might all come at (nearly) the same time.

Opinions? Thanks...

tommeyers
Posts: 184
Joined: Tue Apr 17, 2018 1:51 pm
Location: Santiago, Dominican Republic

Re: crude idea for log storage/retrieval

Postby tommeyers » Wed Dec 04, 2019 10:41 pm

Good idea; logging is necessary for support-ability.

Depending upon what you see in the bursts of log entries it might help keep a more complete history if duplicates of the last entry were simply added to a counter of the last entry. It might prevent the wrap around of the log for bursts of duplicates. Depends what you see.

Tom Meyers
IT Professional, Maker
Santiago, Dominican Republic

gonzalo4444
Posts: 2
Joined: Fri Nov 25, 2022 11:00 pm

Re: crude idea for log storage/retrieval

Postby gonzalo4444 » Fri Nov 25, 2022 11:04 pm

have a solution?

User avatar
mzimmers
Posts: 643
Joined: Wed Mar 07, 2018 11:54 pm
Location: USA

Re: crude idea for log storage/retrieval

Postby mzimmers » Mon Nov 28, 2022 5:02 pm

I did implement a logging facility, but it was more elaborate than I first thought it would be (source file was almost 1200 lines).

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: crude idea for log storage/retrieval

Postby ESP_igrr » Mon Nov 28, 2022 5:54 pm

If a cloud-attached solution is an option there is now also ESP Insights. It lets you collect logs, metrics and core dumps from devices and analyze them in the cloud.

tommeyers
Posts: 184
Joined: Tue Apr 17, 2018 1:51 pm
Location: Santiago, Dominican Republic

Re: crude idea for log storage/retrieval

Postby tommeyers » Tue Nov 29, 2022 12:15 am

Mzimmers you work on cool stuff. I have been following your posts for years, tom
IT Professional, Maker
Santiago, Dominican Republic

Who is online

Users browsing this forum: Bing [Bot], jgrossholtz and 187 guests