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

ensure source field is a string before attempting deserialization #7

Open
colinsurprenant opened this issue Apr 16, 2015 · 2 comments

Comments

@colinsurprenant
Copy link
Contributor

per elastic/logstash#3032 when attempting to parse a field that is not a string, very strange exception is thrown. we should first check that the source field is a string content and error for this first then attempt deserialization.

@johntdyer
Copy link

👍

@booybooy
Copy link

I was hoping that the source field can be both a valid JSON or a string. For the former, the use case is that the json filter is part of a chain of filters.

For instance, I have the following input:
{"results": [{"id" : "a1", "msg" : "hello"}, {"id" : "a2", "msg": "world"}]}

The objective is to split the array and have each element be its own event. I'm using the split filter to split an a JSON array in a JSON input. The output from split filter is:
{"results": {"id": "a1", "msg" : "hello"}}
{"results": {"id": "a2", "msg" : "world"}}

Now, this gets passed down the chain to the json filter to have the inner object extracted to its own event, but it fails with the
Trouble parsing json :exception=>java.lang.ClassCastException: org.jruby.java.proxies.MapJavaProxy cannot be cast to org.jruby.RubyIO, :level=>:warn

The reason is simply that the inner object is not a string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants