reidmorrison / semantic_logger

Semantic Logger is a feature rich logging framework, and replacement for existing Ruby & Rails loggers.
https://logger.rocketjob.io/
Apache License 2.0
870 stars 121 forks source link

Support for non-Elastic *search engines e.g. AWS Opensearch #189

Open antgel opened 2 years ago

antgel commented 2 years ago

Just happily installed rails_semantic_logger in our project, very happy to be using it, thank you! However, we're migrating to AWS OpenSearch rather than Elastic's offering, due to our take on Elastic's approach to Free Software licensing and the community.

I naively added the elasticsearch gem to Gemfile and of course:

E [2308:SemanticLogger::Appender::Elas] SemanticLogger::Appender::Elasticsearch -- Async: Restarting due to exception -- Exception: Elasticsearch::UnsupportedProductError: The client noticed that the server is not Elasticsearch and we do not support this unknown product.

I can pin to 7.13.0 for now as per https://opensearch.org/docs/latest/clients/index/, but it doesn't feel like a long term solution. Will semantic_logger be able to support the opensearch-ruby as an alternative?

reidmorrison commented 2 years ago

Will it require a new appender, or can it auto-detect which gem is loaded and use that one automatically? I.e. Is the new opensearch-ruby gem a drop-in replacement?

reidmorrison commented 2 years ago

If the API is the same, other than the gem and class name, I can create a proof of concept branch if you want to try it out?

antgel commented 2 years ago

Thanks for the response. At this time the gem APIs are close if not identical - who knows what will happen over time.

As for "Will it require a new appender, or can it auto-detect which gem is loaded and use that one automatically?", I'm not sure what you mean by "it", but it's pretty clear that Elastic users will continue to use the elasticsearch-ruby gem, and AWS OpenSearch users will use the opensearch-ruby gem (or elasticsearch-ruby pinned to 7.13.0). It is possible at runtime to fingerprint the ES/OS server via an HTTP request, but of course this is too late in the day to decide which gem to install.