apisix icon indicating copy to clipboard operation
apisix copied to clipboard

init elasticsearch-logger.lua

Open fanchangjifen opened this issue 2 years ago • 20 comments

Description

I followed the clickhouse-Logger implementation logic and the data store was partially adapted for ELasticsearch;By default, index names are divided by date (yyyy.MM.dd),Dbas can further optimize log storage by combining index templates.

fanchangjifen avatar May 22 '22 08:05 fanchangjifen

finally,i use elasticsearch Restful Api and Basic Authorization method,it an suitable for 5.x 、6.x and 7.x versions

fanchangjifen avatar May 22 '22 09:05 fanchangjifen

Hi @fanchangjifen , thanks for your contribution, but please let me know if we ever discussed this on the APISIX mailing list?

tzssangglass avatar May 23 '22 01:05 tzssangglass

没讨论过,我们主要的日志存储、检索沿用ELK技术解决方案,所以看到Clickhouse的实现后,引入Elasticsearch的接入方案。 当然,我们现在的解决方案不仅限于直接直接与Es进行交互

fanchangjifen avatar May 23 '22 10:05 fanchangjifen

for details:

【金山文档】 Plugin elasticsearch-logger test https://kdocs.cn/l/cgTYj4imEMld

fanchangjifen avatar May 28 '22 08:05 fanchangjifen

In the production environment, we may not use direct interface interaction with the storage engine. According to experience, there may be some problems in connection pool and performance. Therefore, we now use date slicing of HTTP-Logger and use FileBeat to collect data. Using ingest pipeline preprocessing specification data persistence, this is the full range of solutions to prevent. However, this plug-in might be an easy way to label Clickhouse-Logger

fanchangjifen avatar May 30 '22 02:05 fanchangjifen

I see. Let's wait for someone who is willing to try this plugin in the product environment.

spacewander avatar May 30 '22 06:05 spacewander

I see. Let's wait for someone who is willing to try this plugin in the product environment.

I still want to know what do I need to do next for this plug-in to be accepted

fanchangjifen avatar May 30 '22 10:05 fanchangjifen

@fanchangjifen can you submit a doc about how to use this plugin? I think this plugin is meaningful now.

It can help more users follow this pr.

membphis avatar May 30 '22 10:05 membphis

for details:

【金山文档】 Plugin elasticsearch-logger test https://kdocs.cn/l/cgTYj4imEMld

@membphis hey,there it is.

fanchangjifen avatar May 30 '22 11:05 fanchangjifen

@fanchangjifen After discussing with @leslie-tsang and @tzssangglass, I am sorry to have to inform you that, given the cost of maintenance, we do not intend to move forward with this feature unless more users are willing to use it.

spacewander avatar May 30 '22 11:05 spacewander

@fanchangjifen After discussing with @leslie-tsang and @tzssangglass, I am sorry to have to inform you that, given the cost of maintenance, we do not intend to move forward with this feature unless more users are willing to use it.

This is just an idea based on the Clickhosue-Logger plugin, and while we regret the final result, we will continue to follow the Apisix project and contribute our thoughts on SM cryptography and logging

fanchangjifen avatar May 30 '22 11:05 fanchangjifen

@fanchangjifen I discussed it again with @tzssangglass. We can accept this plugin but with a requirement: we need to test against real ES.

We can run ES like https://github.com/elastic/elastic-github-actions/blob/master/elasticsearch/run-elasticsearch.sh in https://github.com/apache/apisix/blob/master/ci/pod/docker-compose.yml.

spacewander avatar May 30 '22 13:05 spacewander

The BULK API version has been submitted. In addition to separating data according to newline characters, the id of logs is automatically generated by ES or can be changed to SkyWalking ID late

fanchangjifen avatar Jun 13 '22 13:06 fanchangjifen

It might be difficult for me to write test samples and i don’t know how to write

fanchangjifen avatar Jun 21 '22 15:06 fanchangjifen

It might be difficult for me to write test samples and i don’t know how to write

You can refer to https://github.com/apache/apisix/blob/master/docs/en/latest/internal/testing-framework.md and run the test locally.

Also, some maintainers think we need to run the test with real elasticsearch. You can run ES like https://github.com/elastic/elastic-github-actions/blob/master/elasticsearch/run-elasticsearch.sh in https://github.com/apache/apisix/blob/master/ci/pod/docker-compose.yml. Then change the mock server to proxy the test requests to the real elasticsearch.

spacewander avatar Jun 22 '22 02:06 spacewander

With reference to the official document submit related ci auxiliary https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-file. you may can run the test with real elasticsearch @spacewander What's next?

fanchangjifen avatar Jun 26 '22 02:06 fanchangjifen

Let's merge master to make CI run.

spacewander avatar Jul 03 '22 12:07 spacewander

Let's merge master to make CI run. @spacewander merge conflicts ?

fanchangjifen avatar Jul 30 '22 06:07 fanchangjifen

Let's merge master to make CI run. @spacewander merge conflicts ?

Let's merge master and solve the conflicts.

spacewander avatar Jul 31 '22 12:07 spacewander

Hi~ I noticed that you seem to have no time to deal with this pr, and I'm interested in it, would you please let me continue to come up with this issue? : )

ccxhwmy avatar Aug 10 '22 13:08 ccxhwmy

Hi~ I noticed that you seem to have no time to deal with this pr, and I'm interested in it, would you please let me continue to come up with this issue? : )

@ccxhwmy I have no way to automate the automated testing,I think you can build on what I've done.. I have read the PR you submitted,and I noticed that you didn't complete the logic of X-PACK certification, but i have finished.

@spacewander @tzssangglass #7643 for this issue,It's up to you

fanchangjifen avatar Aug 11 '22 09:08 fanchangjifen

Hi~ I noticed that you seem to have no time to deal with this pr, and I'm interested in it, would you please let me continue to come up with this issue? : )

@ccxhwmy I have no way to automate the automated testing,I think you can build on what I've done.. I have read the PR you submitted,and I noticed that you didn't complete the logic of X-PACK certification, but i have finished.

I will refer to what you have finished, thank you very much!

ccxhwmy avatar Aug 11 '22 11:08 ccxhwmy

@spacewander @tzssangglass #7643 for this issue,It's up to you

Thanks for your contribution, let's do it.

tzssangglass avatar Aug 12 '22 02:08 tzssangglass

@spacewander @tzssangglass #7643 for this issue,It's up to you

Thanks for your contribution, let's do it.

@ccxhwmy As mentioned above, you should use the elasticsearch bulk API (endpoint/index/_bulk)..but I noticed you didn't. @tzssangglass Why not recommend testing on my basis or use my plugin directly.

fanchangjifen avatar Aug 12 '22 06:08 fanchangjifen

As mentioned above, you should use the elasticsearch bulk API (endpoint/index/_bulk)..but I noticed you didn't.

Yes, we need to implement this.

Why not recommend testing on my basis or use my plugin directly.

It's not a decision I made. I guess the reason is the read/write access of the branch, he may not have the write access of your PR branch

tzssangglass avatar Aug 12 '22 09:08 tzssangglass

@spacewander @tzssangglass #7643 for this issue,It's up to you

Thanks for your contribution, let's do it.

@ccxhwmy As mentioned above, you should use the elasticsearch bulk API (endpoint/index/_bulk)..but I noticed you didn't.

Yes, I will implement this suggestion, Thank you.

ccxhwmy avatar Aug 12 '22 13:08 ccxhwmy