christiangalsterer / httpbeat

Elastic Beat to call HTTP endpoints
Apache License 2.0
107 stars 40 forks source link

Support JSON response body #3

Closed ddrozdov closed 8 years ago

ddrozdov commented 8 years ago

This implements issue #2 Store JSON response body in jsonBody field; Transform dot notation to nested JSON

codecov-io commented 8 years ago

Current coverage is 20.11%

Merging #3 into master will increase coverage by +12.73% as of 4ea9915

@@            master      #3   diff @@
======================================
  Files            4       4       
  Stmts          149     179    +30
  Branches         1       6     +5
  Methods          0       0       
======================================
+ Hit             11      36    +25
  Partial          0       0       
- Missed         138     143     +5

Review entire Coverage Diff as of 4ea9915

Powered by Codecov. Updated on successful CI builds.

ddrozdov commented 8 years ago

That's my first experience in Go so it is probably not the best solution, but still it works :)

christiangalsterer commented 8 years ago

Finally I had some time to look into it. What I have in mind is to use only one fields and depending on the type of the response of the HTTP call this is then either a simple string of a json structure.

If the HTTP response can be parsed as a json object then it will be returned as a json structure. Here I plan to use the mode parameter is in your PR. If the HTTP response cannot be parsed as a structure then the response as returned unchanged as a string.

What do you think?

ddrozdov commented 8 years ago

Thought about it, but this would make it impossible to use the same index name for both json and non-json responses because the body field type in Elasticsearch can't be a string and a group at the same time.

christiangalsterer commented 8 years ago

Valid point, will rethink it again.

ddrozdov commented 8 years ago

Any news here?

christiangalsterer commented 8 years ago

I was busy with some activities in the last weeks. I will look into it the next days but most likely the PR will be merged unchanged or only smaller internal changes and keeping the approach using a dedicated field.

christiangalsterer commented 8 years ago

I merged your PR unchanged and a release 1.1.0 is available. Thanks very much for your contribution again.

ddrozdov commented 8 years ago

:thumbsup: