I wondered if anyone had any good patterns or advice on collecting logs from a single-page application (SPA) running in user browsers and getting them into Elasticsearch? I guess one approach might be to post AJAX to a /logs endpoint on our backend.
that sounds like a sensible approach, especially since it doesn't leak sensitive customer information to third-party services. This is a particularly useful property since it is less likely to be blocked by privacy-enhancing browser plugins and doesn't require additional legal data processing agreements. (I'm not a legal expert though, so please don't take this as legal advice. Your legal council and data protection officer should be involved in designing this.)
There are a few features that could improve the UX and DX such as buffering/batching the submissions in general while immediate flushing to server for error logs.
If you opt to implement something like that for yourself, I would recommend taking a look at the Elastic Common Schema to guide your design. That will make correlation with other log sources, e.g. from filebeat a lot easier down the road.
I'd be interested to hear what approach you decide on.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.