/api/search/universal/absolute 500 response on providing query in params field


(Shakeel Ahmed) #1

Hi,
I am trying to use API /api/search/universal/absolute and getting ApiError in response(explained below)

Issue : This API works in swagger and if I call formatted URL(see Example-2) but it doesn’t work if I send queries in parameter field of REST API tool.

Example-1
On sending query from parameters::
Response is 500

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

PFA:

Example-2

curl -k -u admin:<password> -sS "https://<graylog-ip>/api/search/universal/absolute?query=streams%3A5b39fb77b273cb07240d9102&from=2018-07-09T10%3A15%3A00.000Z&to=2018-07-09T10%3A30%3A00.000Z&decorate=true" -H "Accept: application/json"

response:
200 and { data }

Can you please help me on this issue.


(Jochen) #2

Check the logs of your Graylog node(s):
http://docs.graylog.org/en/2.4/pages/configuration/file_location.html


(Shakeel Ahmed) #3
2018-07-11_10:17:32.21868 ERROR [AnyExceptionClassMapper] Unhandled exception in REST resource
2018-07-11_10:17:32.22010 java.lang.NullPointerException: null
2018-07-11_10:17:32.22109       at org.graylog2.plugin.indexer.searches.timeranges.AbsoluteRange$Builder.parseDateTime(AbsoluteRange.java:114) ~[graylog.jar:?]
2018-07-11_10:17:32.22210       at org.graylog2.plugin.indexer.searches.timeranges.AbsoluteRange$Builder.from(AbsoluteRange.java:106) ~[graylog.jar:?]
2018-07-11_10:17:32.22494       at org.graylog2.plugin.indexer.searches.timeranges.AbsoluteRange.create(AbsoluteRange.java:63) ~[graylog.jar:?]
2018-07-11_10:17:32.22560       at org.graylog2.rest.resources.search.AbsoluteSearchResource.buildAbsoluteTimeRange(AbsoluteSearchResource.java:354) ~[graylog.jar:?]
2018-07-11_10:17:32.23642       at org.graylog2.rest.resources.search.AbsoluteSearchResource.searchAbsolute(AbsoluteSearchResource.java:103) ~[graylog.jar:?]
2018-07-11_10:17:32.23688       at sun.reflect.GeneratedMethodAccessor227.invoke(Unknown Source) ~[?:?]
2018-07-11_10:17:32.23691       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_172]
2018-07-11_10:17:32.23694       at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_172]
2018-07-11_10:17:32.23695       at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) ~[graylog.jar:?]
2018-07-11_10:17:32.23985       at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) ~[graylog.jar:?]
2018-07-11_10:17:32.23989       at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) ~[graylog.jar:?]
2018-07-11_10:17:32.23991       at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:205) ~[graylog.jar:?]
2018-07-11_10:17:32.23992       at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) ~[graylog.jar:?]
2018-07-11_10:17:32.24479       at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) ~[graylog.jar:?]
2018-07-11_10:17:32.24546       at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) ~[graylog.jar:?]
2018-07-11_10:17:32.24703       at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) ~[graylog.jar:?]
2018-07-11_10:17:32.24956       at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326) [graylog.jar:?]
2018-07-11_10:17:32.24958       at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) [graylog.jar:?]
2018-07-11_10:17:32.24958       at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) [graylog.jar:?]
2018-07-11_10:17:32.25002       at org.glassfish.jersey.internal.Errors.process(Errors.java:315) [graylog.jar:?]
2018-07-11_10:17:32.25407       at org.glassfish.jersey.internal.Errors.process(Errors.java:297) [graylog.jar:?]
2018-07-11_10:17:32.25457       at org.glassfish.jersey.internal.Errors.process(Errors.java:267) [graylog.jar:?]
2018-07-11_10:17:32.25506       at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) [graylog.jar:?]
2018-07-11_10:17:32.25543       at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) [graylog.jar:?]
2018-07-11_10:17:32.26203       at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) [graylog.jar:?]
2018-07-11_10:17:32.26360       at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:384) [graylog.jar:?]
2018-07-11_10:17:32.26531       at org.glassfish.grizzly.http.server.HttpHandler$1.run(HttpHandler.java:224) [graylog.jar:?]
2018-07-11_10:17:32.26697       at com.codahale.metrics.InstrumentedExecutorService$InstrumentedRunnable.run(InstrumentedExecutorService.java:176) [graylog.jar:?]
2018-07-11_10:17:32.26879       at emphasized textjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_172]
2018-07-11_10:17:32.26932       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_172]
2018-07-11_10:17:32.27079       at java.lang.Thread.run(Thread.java:748) [?:1.8.0_172]

(Jochen) #4

You’re missing the from query parameter.

When you look at the generated URI in your browser, you see the url-encoded trailing space ("%20") in the from parameter’s name.

This being said, the correct error message would be a hint to the missing parameter and not an internal server error (HTTP status 500).

For reference:


(Shakeel Ahmed) #5

Hi Jochen,

Thanks a lot. Yes, after removing the extra space it worked. A proper response would have helped me much early.

It would be much helpful if you can share a documentation link explaining about all the fields for each API so that I can play around with available options.(currently I am referring to swagger).

-Shakeel.


(Jochen) #6

This will be fixed with the pull request I’ve linked to.

The Graylog REST API Browser is the canonical source of information about the Graylog REST API.