HTTP Output Could not fetch url (Illegal character)

Hi! I'm an university student working on his final degree project, and I can't find any info about the problem I'm having. I need to send logs through Logstash with http but it says it can't fetch the url. I think the problem is with the double point character ":", and the problem is I MUST specify the http port in the url since in the port 80 of the IP address there is a webpage, so I can't use the ip only without specifying the port (also I need to specify the path too to point exactly where I want) . Here are the things from logstash and the config file:

Partial code from .conf file

output {
    http {
        url => "10.120.240.1:8080/v1/log/logstashtest"
        http_method => "post"
        headers => {
            "Authorization" => "Bearer XXXXX"
        }
    }
}

Output from Logstash:

[ERROR] 2022-03-11 12:14:57.447 [[main]>worker1] http - [HTTP Output Failure] Could not fetch URL {:url=>"10.120.240.1:8080/v1/log/logstashtest", :method=>:post, :message=>"Illegal character in scheme name at index 0: 10.120.240.1:8080/v1/log/logstashtest", :class=>"Java::JavaNet::URISyntaxException", :will_retry=>false}  

So the question is: Is there a solution to this? Can I specify the url as:

  • Host: (the ip)
  • Port: 8080
  • Path: /v1/log/logstashtest
    in any way? I don't undestand why it detects that as an illegal character since it it a valid url.

Also I have an additional question not directly related to the problem, but more like for knowledge purposes: with the http output, a log is sent as the message of the body of the http request right? Or is it sent as a file? (As I said I'm a student so I'm still learning about these things yet, so sorry if it is a stupid question :sweat_smile: This is an example of a curl command that works: curl -H 'Authorization: Bearer XXXXX' -d '{<log>}' 10.120.240.1:8080/v1/log/logstashtest, where <log> is one log sent in json format (not json file) in the body of the request.

Thank you very much in advance!

Have you tried http://10.120.240.1:8080/v1/log/logstashtest?

Hi! Sorry for the lack of reply during the weekend. Yes that worked! I didn't even realize I didn't write that :man_facepalming:

Thank you very much for your time, and sorry for the stupid problem

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