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

String conversion problem with select_jsonpath() function #68

Closed
lennartkoopmann opened this Issue Jul 29, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@lennartkoopmann
Member

lennartkoopmann commented Jul 29, 2016

Problem description

When trying to use the select_jsonpath() function, storing a message with an extracted String in Elasticsearch will fail:

2016-07-29T15:51:33.188-05:00 ERROR [BlockingBatchedESOutput] Unable to flush message buffer
java.lang.ClassCastException: Cannot cast com.fasterxml.jackson.databind.node.TextNode to java.lang.String
    at java.lang.Class.cast(Class.java:3369) ~[?:1.8.0_101]
    at org.graylog2.plugin.Message.getFieldAs(Message.java:371) ~[graylog.jar:?]
    at org.graylog2.plugin.Message.getMessage(Message.java:287) ~[graylog.jar:?]
    at org.graylog2.plugin.Message.toElasticSearchObject(Message.java:216) ~[graylog.jar:?]
    at org.graylog2.indexer.messages.Messages.bulkIndex(Messages.java:116) ~[graylog.jar:?]
    at org.graylog2.indexer.messages.Messages.bulkIndex(Messages.java:106) ~[graylog.jar:?]
    at org.graylog2.outputs.ElasticSearchOutput.write(ElasticSearchOutput.java:98) ~[graylog.jar:?]
    at org.graylog2.outputs.BlockingBatchedESOutput.flush(BlockingBatchedESOutput.java:128) [graylog.jar:?]
    at org.graylog2.outputs.BlockingBatchedESOutput.forceFlushIfTimedout(BlockingBatchedESOutput.java:158) [graylog.jar:?]
    at org.graylog2.periodical.BatchedElasticSearchOutputFlushThread.doRun(BatchedElasticSearchOutputFlushThread.java:88) [graylog.jar:?]
    at org.graylog2.plugin.periodical.Periodical.run(Periodical.java:77) [graylog.jar:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_101]
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) [?:1.8.0_101]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_101]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) [?:1.8.0_101]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_101]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_101]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_101]

Calling to_string() on the extracted field works, but will wrap the string in quotes. I had to use another regex() function to get rid of the quotes.

Environment

  • Graylog Version: 2.1.0-beta.1
  • Pipeline Processor plugin version: 1.1.0-beta.1
  • Elasticsearch Version: 2.3.1

kroepke added a commit that referenced this issue Aug 2, 2016

unwrap JsonNode values
e.g. strings would be double quoted without this

fixes #68
@tokred

This comment has been minimized.

tokred commented Aug 3, 2016

May I ask which rule code you used? Because for me, select_jsonpath is not working at all, however lacks an exception, see #40

@bernd bernd closed this in #72 Aug 8, 2016

bernd added a commit that referenced this issue Aug 8, 2016

unwrap JsonNode values (#72)
e.g. strings would be double quoted without this

fixes #68
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment