cURL redirection for Graylog API


I have struggled a bit with the installation itself, due to incorrectly configuring the IP addresses, an internal IP address with it’s corresponding NAT for public availability; the instance is running on Amazon AWS. After that issue was finally resolved, I have noticed in the logs the following error,

2019-06-06T12:09:07.094Z WARN [ProxiedResource] Unable to call http://public_ip_address:9000/api/system/metrics/multiple on node <node_id> connect timed out

I have tried Googling a bit around and followed a few troubleshooting steps, which led me to start testing with cURL, whether I could access the aforementioned API URL. That was not possible from the instance itself, but it was working properly from my laptop, which I was using for remotely managing the Graylog server. The issue was the access list on Amazon AWS, not allowing the instance itself to reach its own public IP address, so I have adjusted the access list, allowed all traffic and the issue was resolved; the error disappeared from the logs.

Back to the cURL testing using the command,

curl -i ‘http://public_ip_address:9000/api/?pretty=true’

I was getting the following,

HTTP/1.1 307 Temporary Redirect
Location: http://public_ip_address:9000/
X-Graylog-Node-ID: node_id
X-Runtime-Microseconds: 194
Date: Thu, 06 Jun 2019 13:07:19 GMT
Content-Length: 0

After Googling again, someone suggested to use the -L option which essentially follows the redirects and that has resolved the issue, adjusting the command to curl -iL instead.

Apologies for the long text, I would like to know first, why I need the -L option while others can get the same output without it, as well as a brief explanation as to what it actually does.

Thank you in advance.

he @croussou

glad that you have fixed your issue!

I did not know how you have exactly configured what and what moving parts you have in your Setup - that is why I can’t answer why you needed the -L option for curl.

I’m not good in guessing. But maybe this information might help others.

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