Has the /api/search/universal/absolute API changed in gl-2.3?

Hi there

We just upgraded from the last 2.2 release to graylog-server-2.3.0-7.noarch and a search script we have no longer works

It seems to be that “Accept: application/json” is no longer supported. If I drop the Accept header, it works - but I get CSV format instead of the JSON I want

ie

curl -m 20 -s -uxxxtoken -H ‘Accept: application/json’ -X GET http…/api/search/universal/absolute?query=blah…

returns a “ApiError” error, but dropping the Accept header works. Looking at the API browser, I can see TWO /api/search/universal/absolute options - the latter supposedly supports JSON - but the examples they give are identical - ie no indication how JSON appears (if not by the Accept header)

Any ideas how to get the JSON back? Thanks

Jason

What’s the complete query?

What kind of error?

OK, this works (but returns CSV)

curl -X GET 'http://gray.log.servert:12900/search/universal/absolute?query=application_name:squid&from=2017-08-10%2015%3A38%3A53&to=2017-08-10%2016%3A38%3A53&limit=10&fields=message,source,application_name'

but this doesn’t

curl -H 'Accept: application/json' -X GET 'http://gray.log.servert:12900/search/universal/absolute?query=application_name:squid&from=2017-08-10%2015%3A38%3A53&to=2017-08-10%2016%3A38%3A53&limit=10&fields=message,source,application_name'

It generates the error

{"type":"ApiError","message":""}

curl -v shows it’s a “HTTP/1.1 500 Internal Server Error” . So I looked at the graylog server log and it shows this

2017-08-10T16:43:19.077Z ERROR [AnyExceptionClassMapper] Unhandled exception in REST resource
java.lang.NullPointerException: null
	at org.graylog2.indexer.searches.Searches.lambda$search$3(Searches.java:272) ~[graylog.jar:?]
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_141]
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) ~[?:1.8.0_141]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:1.8.0_141]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_141]
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_141]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_141]
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[?:1.8.0_141]
	at org.graylog2.indexer.searches.Searches.search(Searches.java:273) ~[graylog.jar:?]
	at org.graylog2.rest.resources.search.AbsoluteSearchResource.searchAbsolute(AbsoluteSearchResource.java:111) ~[graylog.jar:?]
	at sun.reflect.GeneratedMethodAccessor444.invoke(Unknown Source) ~[?:?]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_141]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_141]
	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) ~[graylog.jar:?]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) ~[graylog.jar:?]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) ~[graylog.jar:?]
	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:205) ~[graylog.jar:?]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) ~[graylog.jar:?]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) ~[graylog.jar:?]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) ~[graylog.jar:?]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) ~[graylog.jar:?]
	at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326) [graylog.jar:?]
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) [graylog.jar:?]
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) [graylog.jar:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315) [graylog.jar:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:297) [graylog.jar:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:267) [graylog.jar:?]
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) [graylog.jar:?]
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) [graylog.jar:?]
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) [graylog.jar:?]
	at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:384) [graylog.jar:?]
	at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:224) [graylog.jar:?]
	at com.codahale.metrics.InstrumentedExecutorService$InstrumentedRunnable.run(InstrumentedExecutorService.java:176) [graylog.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_141]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_141]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_141]

This will be fixed in Graylog 2.3.1:


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.