Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Output clickhouse #132

Closed
wants to merge 3 commits into from
Closed

[WIP] Output clickhouse #132

wants to merge 3 commits into from

Conversation

pachico
Copy link

@pachico pachico commented Apr 20, 2020

Hi, this is still work in progress (features, docs and tests still missing) but basic functionality is there.
Do you think you can have a look at it and let me know if I'm totally misguided or if you see this as a possible merge in the future?

Thanks in advance

queryString := fmt.Sprintf("INSERT INTO %s FORMAT JSONEachRow", t.TargetTable)
requestURL := fmt.Sprintf("%s?query=%s", t.DSN, url.QueryEscape(queryString))

request, _ := http.NewRequest("POST", requestURL, strings.NewReader(string(newEventAsJSON)))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not ignore any errors.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing, will do.

for _, key := range t.Fields {
fieldValue, exists := event.GetValue(key)

if true == exists {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if true == exists {
if exists {

"context"
"fmt"
"io/ioutil"
"log"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

try github.com/tsaikd/gogstash/config/goglog

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see not all plugins use it but if it's the desired one I will implement it.

}

if resp.StatusCode != 200 {
defer resp.Body.Close()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://godoc.org/net/http

The client must close the response body when finished with it

Does the pester HTTP client has different behavior?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and I want to implement it. It mostly handles retries, which reduces the possibility of missed documents. I want users to be able to customise it as they do for elastic plugin.

@pachico
Copy link
Author

pachico commented Apr 21, 2020

I addition, I want to implement batch processing since ClickHouse prefers it

@dairongpeng
Copy link

Hi, is there a plan to merge?

@tsaikd
Copy link
Owner

tsaikd commented Sep 7, 2021

I don't see any actions after the last review.

@pachico
Copy link
Author

pachico commented Sep 8, 2021

I won't proceed with this draft since I'm currently using another solution that already has ClickHouse output option.

@pachico pachico closed this Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants