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

Could not get stream throughput #25

Open
xavierhardy opened this issue Nov 15, 2016 · 7 comments
Open

Could not get stream throughput #25

xavierhardy opened this issue Nov 15, 2016 · 7 comments

Comments

@xavierhardy
Copy link

When opening a valid stream (I get another error when using an invalid title), I get the following error. The dashboard is not even displayed.

Error: Could not get stream throughput. Bad status code: 404 Not Found [object Object]
    at makeRequest.then.catch (/home/xhardy/Programs/node/lib/node_modules/graylog-cli-dashboard/lib/graylog-api.js:77:13)
    at tryCatcher (/home/xhardy/Programs/node/lib/node_modules/graylog-cli-dashboard/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/xhardy/Programs/node/lib/node_modules/graylog-cli-dashboard/node_modules/bluebird/js/release/promise.js:510:31)
    at Promise._settlePromise (/home/xhardy/Programs/node/lib/node_modules/graylog-cli-dashboard/node_modules/bluebird/js/release/promise.js:567:18)
    at Promise._settlePromise0 (/home/xhardy/Programs/node/lib/node_modules/graylog-cli-dashboard/node_modules/bluebird/js/release/promise.js:612:10)
    at Promise._settlePromises (/home/xhardy/Programs/node/lib/node_modules/graylog-cli-dashboard/node_modules/bluebird/js/release/promise.js:687:18)
    at Async._drainQueue (/home/xhardy/Programs/node/lib/node_modules/graylog-cli-dashboard/node_modules/bluebird/js/release/async.js:138:16)
    at Async._drainQueues (/home/xhardy/Programs/node/lib/node_modules/graylog-cli-dashboard/node_modules/bluebird/js/release/async.js:148:10)
    at Immediate.Async.drainQueues (/home/xhardy/Programs/node/lib/node_modules/graylog-cli-dashboard/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:637:20)
    at tryOnImmediate (timers.js:610:5)
    at processImmediate [as _immediateCallback] (timers.js:582:5)
@xavierhardy
Copy link
Author

Node version v6.9.1, using package version 1.0.0

@DerPhlipsi
Copy link

I think know the reason for your problem. graylog-dashboard.js forces the URL to have :12900 in it (see line 92)

// Make sure we have a port (default REST API port is 12900)
if (!/:\d+$/.test(config.serverURL)) config.serverURL += ':12900';
// Make sure config.serverURL has a trailing slash. (computers.)
if (config.serverURL[config.serverURL.length - 1] !== '/') config.serverURL += '/';
return config
});

This is a problem since I (and you probably too) have the Graylog API available at the URL https://graylog.example.com/api/. This can be seen when you add a little debug to the Error message:

Error: Could not get streams.
-->url: https://graylog.example.com/api/:12900/streams
-->response:

Error: Bad status code: 404 Not Found [object Object]
at request.getAsync.then (/usr/lib/node_modules/graylog-cli-dashboard/lib/graylog-api.js:99:13)
at tryCatcher (/usr/lib/node_modules/graylog-cli-dashboard/node_modules/bluebird/js/release util.js:16:23)

So the fix for this is to simply comment out line 92 :)

@STRML
Copy link
Collaborator

STRML commented Jan 12, 2017 via email

@DerPhlipsi
Copy link

Well, that didn't fix it for me. It surprised me too, because the if statement is searching for :. I had to comment out that line to get it to work.

@STRML
Copy link
Collaborator

STRML commented Jan 12, 2017

Oh yeah; it's not assuming a path at all... the regex is looking for :\d+$, aka end of string. Would be smarter if it just parsed the url.

It appears there are two configuration options for the API now as of 2.1; separate port, or same port separated by path.

I won't have time for a bit to work on this; would be happy to accept a PR. To be honest, just removing this attempt to be smart would be fine, so long as there's a better error message for when we 404 (something like "is this API URL (${apiURL}) correct?")

@DerPhlipsi
Copy link

I'll make a proper fix and open a PR :)

@vincebowdren
Copy link

@DerPhlipsi I don't think it is the problem with the server configuration, because if it was then the OP would get a failure on the very first api call made (get /streams), and it would probably be a connection failure.
A 404 response means that the connection has been made successfully, and the graylog api server is explicitly returning a 404 for some reason.

@xavierhardy : It's worth running a reverse proxy (e.g. nginx) in front of graylog to find out exactly what the api call is which is failing, and if possible to find out the response details. It might (or might not) be the same problem I've reported in #28.

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

No branches or pull requests

4 participants