datalust / seq-input-gelf

Ingest GELF payloads into Seq
https://datalust.co/seq
Apache License 2.0
15 stars 8 forks source link

Ingestion failed: Invalid URI: The URI scheme is not valid. #101

Closed vatavale closed 2 years ago

vatavale commented 2 years ago

I'm trying to collect logs from docker containers. All containers are running on the same host.


  seq:
    image: datalust/seq:latest
    container_name: seq
    restart: unless-stopped
    environment:
      - ACCEPT_EULA=Y
    ports:
      - "81:80"
      - "5341:5341"
    volumes:
      - seq-logs:/data

  seq-gelf:
    image: datalust/seq-input-gelf:latest
    container_name: seq-gelf
    restart: unless-stopped
    environment:
      - ACCEPT_EULA=Y
      - GELF_ENABLE_DIAGNOSTICS=True
      - SEQ_ADDRESS="http://seq:5341"
            # Same errors with:
            # - SEQ_ADDRESS="seq:5341"
            # - SEQ_ADDRESS="http://host.docker.internal:5341"
            # - SEQ_ADDRESS="http://localhost:5341"
            # - SEQ_ADDRESS="localhost:5341"
            # - SEQ_ADDRESS="127.0.0.1:5341"
    depends_on:
      - seq
    ports:
      - "12201:12201/udp"

nginx:
    ...
    logging:
        driver: "gelf"
        options:
          gelf-address: "udp://host.docker.internal:12201"
            # gelf-address: "udp://seq-gelf:12201" 

Error message in seq-gelf (repeated):

Ingestion failed: Invalid URI: The URI scheme is not valid.
System.UriFormatException: Invalid URI: The URI scheme is not valid.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind, UriCreationOptions& creationOptions)
at System.Uri..ctor(String uriString)
at Seq.Api.Client.SeqApiClient..ctor(String serverUrl, String apiKey, Action`1 configureHttpClientHandler)
at Seq.Api.SeqConnection..ctor(String serverUrl, String apiKey, Action`1 configureHttpClientHandler)
at SeqCli.Connection.SeqConnectionFactory.Connect(ConnectionFeature connection) in /home/appveyor/projects/seqcli/src/SeqCli/Connection/SeqConnectionFactory.cs:line 36
at SeqCli.Cli.Commands.IngestCommand.Run() in /home/appveyor/projects/seqcli/src/SeqCli/Cli/Commands/IngestCommand.cs:line 96
thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1193:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
{"@t":"2022-05-24T07:18:41.833597300Z","@l":"ERROR","@mt":"GELF input failed","@x":"failed printing to stdout: Broken pipe (os error 32)"}

Do I understand correctly that the error "Invalid URI: The URI scheme is not valid" means that seq-gelp cannot find the seq service? Looks like the seq container itself works fine:

[07:06:02 INF] Seq "2022.1.7449" running on OS "Linux 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022"
[07:06:02 INF] Seq detected 6543.028224 MB of RAM
[07:06:04 INF] Opening event store at "/data/Stream/stream.flare"
[07:06:04 INF] Ingestion enabled
[07:06:04 INF] Opening metastore "/data/Documents/metastore.flare"
[07:06:04 INF] Storage subsystem available
[07:06:04 INF] Seq listening on ["http://localhost/", "https://localhost/", "http://localhost:5341/", "https://localhost:45341/"]
[07:07:04 INF] 1 more generation 2 garbage collection(s) occurred
[07:11:04 INF] Metrics sampled
[07:16:04 INF] Metrics sampled
[07:16:04 INF] Applying 0 retention policies
[07:16:04 INF] Retention processing and compaction took 16.2288 ms; allocating 599983.7712 ms for indexing

I can connect to its web interface (with no captured events inside).

What's wrong with my config?

liammclennan commented 2 years ago

Hi @vatavale,

Should the keys and values be separated by : instead of =?

I.e.

- SEQ_ADDRESS="http://seq:5341" => - SEQ_ADDRESS: "http://seq:5341"

If that doesn't work, perhaps try starting with the example in the README, get that to work, then modify it.

vatavale commented 2 years ago

Hi, @liammclennan,

Thank you for the help! You are right.

Turns out it's wrong to use quotation marks when using this syntax with = sign.

This two options are working right:

    environment:
      - SEQ_ADDRESS=http://seq:5341

    environment:
      SEQ_ADDRESS: "http://seq:5341"

And a side note about README example. In my docker-compose (syntax version: '3.9') this setup is not working (container exit because of EULA):

    environment:
      ACCEPT_EULA: Y

but this one works:

    environment:
      ACCEPT_EULA: "Y"
liammclennan commented 2 years ago

I'm glad you found a solution. Thanks for the note about the README.