sonyxperiadev / lumber-mill

Where logs are cut into lumber
Apache License 2.0
12 stars 6 forks source link

StringTemplate variables does not handle nested json #28

Closed jrask closed 7 years ago

jrask commented 7 years ago

It is not possible to extract a value that is not in the root level o a json document.

  1. Consider the logstash approach, this is probably the easiest to implement and get efficient.
StringTemplate.compile("My name is {[root][name]}")
  1. Another approach is to use JsonPath, https://github.com/jayway/JsonPath. This would be awesome, but I am not sure how efficient it would be. Would be cool to test and probably very useful.
jrask commented 7 years ago

After digging a little bit I found that Jackson supports JsonPointers. https://tools.ietf.org/html/draft-ietf-appsawg-json-pointer-03.

Super simple way to add this feature in lumber-mill. Instead of going the logstash way we can use the below syntax which actually looks nicer.

StringTemplate.compile("My name is {/root/name}")

I am on this.