# HTTP Output Could not fetch url (Illegal character)

**URL:** https://discuss.elastic.co/t/http-output-could-not-fetch-url-illegal-character/299439
**Category:** Logstash
**Created:** [March 11, 2022, 11:25am UTC](https://discuss.elastic.co/t/http-output-could-not-fetch-url-illegal-character/299439 "2022-03-11T11:25:02Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![josemariafrupm](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@josemariafrupm](https://discuss.elastic.co/u/josemariafrupm)
#### Post date: [March 11, 2022, 11:25am UTC](https://discuss.elastic.co/t/http-output-could-not-fetch-url-illegal-character/299439/1 "2022-03-11T11:25:02Z")

</div>

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

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

```

Output from Logstash:

```auto
[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 😅 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!

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [March 11, 2022, 4:47pm UTC](https://discuss.elastic.co/t/http-output-could-not-fetch-url-illegal-character/299439/2 "2022-03-11T16:47:04Z")

</div>

> [@josemariafrupm](#):
>
> `url => "10.120.240.1:8080/v1/log/logstashtest"`

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

---

<div class="post-metadata">

### Author: ![josemariafrupm](https://avatars.discourse-cdn.com/v4/letter/j/eb9ed0/32.png) [@josemariafrupm](https://discuss.elastic.co/u/josemariafrupm)
#### Post date: [March 14, 2022, 8:23am UTC](https://discuss.elastic.co/t/http-output-could-not-fetch-url-illegal-character/299439/3 "2022-03-14T08:23:58Z")

</div>

Hi! Sorry for the lack of reply during the weekend. Yes that worked! I didn't even realize I didn't write that 🤦‍♂️

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [April 11, 2022, 8:24am UTC](https://discuss.elastic.co/t/http-output-could-not-fetch-url-illegal-character/299439/4 "2022-04-11T08:24:25Z")

</div>

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