datalust / seq-input-gelf

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

Nothing being received in Seq? (Laravel / Gelf / Seq) #79

Closed alexc-hollywood closed 4 years ago

alexc-hollywood commented 4 years ago

Attempting to send errors from Laravel framework through its Logging engine as GELF to Seq.

Docker compose setup:

    seq-input-gelf:
      image: datalust/seq-input-gelf:latest
      depends_on:
        - seq
      environment:
        GELF_ADDRESS: "tcp://0.0.0.0:12201"
        SEQ_ADDRESS: "http://seq:5341"
        GELF_ENABLE_DIAGNOSTICS: "True"
      ports:
        - "12201:12201"
      restart: unless-stopped

    seq:
      container_name: seq
      image: datalust/seq:latest
      restart: unless-stopped
      environment:
        - ACCEPT_EULA=y
      ports:
        - "9595:80"
        - "5341:5341"
      networks:
        - frontend
        - backend

Ports are up:

sudo netstat -tunlp | grep docker
tcp6       0      0 :::8080                 :::*                    LISTEN      967/docker-proxy    
tcp6       0      0 :::81                   :::*                    LISTEN      1622/docker-proxy   
tcp6       0      0 :::85                   :::*                    LISTEN      1636/docker-proxy   
tcp6       0      0 :::3000                 :::*                    LISTEN      1024/docker-proxy   
tcp6       0      0 :::3001                 :::*                    LISTEN      1010/docker-proxy   
tcp6       0      0 :::9595                 :::*                    LISTEN      28504/docker-proxy  
tcp6       0      0 :::444                  :::*                    LISTEN      1605/docker-proxy   
tcp6       0      0 :::5341                 :::*                    LISTEN      28516/docker-proxy  
tcp6       0      0 :::8000                 :::*                    LISTEN      1570/docker-proxy   
tcp6       0      0 :::8001                 :::*                    LISTEN      981/docker-proxy    
tcp6       0      0 :::4200                 :::*                    LISTEN      994/docker-proxy    
tcp6       0      0 :::12201                :::*                    LISTEN      28686/docker-proxy  
tcp6       0      0 :::6379                 :::*                    LISTEN      32595/docker-proxy  
tcp6       0      0 :::2222                 :::*                    LISTEN      1036/docker-proxy   

Docker ps:

CONTAINER ID        IMAGE                            COMMAND                  CREATED             STATUS              PORTS                                                                                                                            NAMES
2ecfcc9e27c1        datalust/seq-input-gelf:latest   "/run.sh"                46 minutes ago      Up 9 seconds        0.0.0.0:12201->12201/tcp                                                                                                         laradock_seq-input-gelf_1
82fab54a885f        datalust/seq:latest              "/run.sh"                6 hours ago         Up 12 seconds       0.0.0.0:5341->5341/tcp, 0.0.0.0:9595->80/tcp                                                                                     seq
efa6294f46ec        laradock_nginx                   "/docker-entrypoint.…"   3 days ago          Up 2 hours          0.0.0.0:81->81/tcp, 0.0.0.0:85->80/tcp, 0.0.0.0:444->443/tcp                                                                     laradock_nginx_1
2603eecd14ff        centrifugo/centrifugo:latest     "centrifugo --admin …"   5 weeks ago         Up 2 hours          0.0.0.0:8000->8000/tcp                                                                                                           centrifugo
972219fdfe72        laradock_php-fpm                 "docker-php-entrypoi…"   6 weeks ago         Up 2 hours          9000/tcp                                                                                                                         laradock_php-fpm_1
00babde04deb        laradock_workspace               "/sbin/my_init"          6 weeks ago         Up 2 hours          0.0.0.0:3000-3001->3000-3001/tcp, 0.0.0.0:4200->4200/tcp, 0.0.0.0:8080->8080/tcp, 0.0.0.0:2222->22/tcp, 0.0.0.0:8001->8000/tcp   laradock_workspace_1
b38d17dfe6fd        laradock_redis                   "docker-entrypoint.s…"   7 weeks ago         Up 2 hours          0.0.0.0:6379->6379/tcp                                                                                                           laradock_redis_1
5f427856464b        docker:19.03-dind                "dockerd-entrypoint.…"   7 weeks ago         Up 2 hours          2375-2376/tcp

Container:

docker inspect 2ecfcc9e27c1
[
    {
        "Id": "2ecfcc9e27c1707a6505b94f85f10db3d9e50294b3d917a49193d4a13b1a9533",
        "Created": "2020-10-24T00:04:41.109211Z",
        "Path": "/run.sh",
        "Args": [],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 31665,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2020-10-24T01:18:56.113073771Z",
            "FinishedAt": "2020-10-24T01:15:57.317327958Z"
        },
        "Image": "sha256:f38aa667762f7ec94470381cfc694f3a56ac12950d6a2a91a2125fb369e6f922",
        "ResolvConfPath": "/var/lib/docker/containers/2ecfcc9e27c1707a6505b94f85f10db3d9e50294b3d917a49193d4a13b1a9533/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/2ecfcc9e27c1707a6505b94f85f10db3d9e50294b3d917a49193d4a13b1a9533/hostname",
        "HostsPath": "/var/lib/docker/containers/2ecfcc9e27c1707a6505b94f85f10db3d9e50294b3d917a49193d4a13b1a9533/hosts",
        "LogPath": "/var/lib/docker/containers/2ecfcc9e27c1707a6505b94f85f10db3d9e50294b3d917a49193d4a13b1a9533/2ecfcc9e27c1707a6505b94f85f10db3d9e50294b3d917a49193d4a13b1a9533-json.log",
        "Name": "/laradock_seq-input-gelf_1",
        "RestartCount": 0,
        "Driver": "overlay2",
        "Platform": "linux",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "docker-default",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": [],
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "laradock_default",
            "PortBindings": {
                "12201/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "12201"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "unless-stopped",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": [],
            "CapAdd": null,
            "CapDrop": null,
            "Capabilities": null,
            "Dns": null,
            "DnsOptions": null,
            "DnsSearch": null,
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "shareable",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": null,
            "DeviceCgroupRules": null,
            "DeviceRequests": null,
            "KernelMemory": 0,
            "KernelMemoryTCP": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": false,
            "PidsLimit": null,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "MaskedPaths": [
                "/proc/asound",
                "/proc/acpi",
                "/proc/kcore",
                "/proc/keys",
                "/proc/latency_stats",
                "/proc/timer_list",
                "/proc/timer_stats",
                "/proc/sched_debug",
                "/proc/scsi",
                "/sys/firmware"
            ],
            "ReadonlyPaths": [
                "/proc/bus",
                "/proc/fs",
                "/proc/irq",
                "/proc/sys",
                "/proc/sysrq-trigger"
            ]
        },
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/5298058a795f83d9e86b1b8740617801f5c2bb2cdafb98af33aac792ba89e739-init/diff:/var/lib/docker/overlay2/ed3a80ad4efa9b8276672d59a21aa737733c7799084b4e134bc6c2efe3b6ef72/diff:/var/lib/docker/overlay2/2cc724d60dd8d915cbd81a44951988516f5c858db29dafe20ae8225ec727630a/diff:/var/lib/docker/overlay2/048682b30311cd1ded7e21f4b660edac34b4c2d7df0b8c38401f84138d8b3a83/diff:/var/lib/docker/overlay2/90919bd42ef5416ef38d320eb8e254a77f31c504e0dbee659dd50479768e4743/diff:/var/lib/docker/overlay2/a7fd0c10de414b09f22d07bca10e70c90081038a04abbf61eb391aa3211c41b7/diff:/var/lib/docker/overlay2/abee0aa1b60197ec3c7ed6531c848e5343d6a177c3cea31112b9be4f3f2e4f93/diff:/var/lib/docker/overlay2/ba32dc821992935c235bb0716296bc9f18b00adb3e444c412951e6d524de2f99/diff:/var/lib/docker/overlay2/b5149eec63b97c516a2dea575716d1a6d912efba4ab7ca1b1c99da89e2e89e48/diff:/var/lib/docker/overlay2/38e7570a730d82deda53c0ca31f02d78a1608bb9841f8aacb87273aad798af0f/diff",
                "MergedDir": "/var/lib/docker/overlay2/5298058a795f83d9e86b1b8740617801f5c2bb2cdafb98af33aac792ba89e739/merged",
                "UpperDir": "/var/lib/docker/overlay2/5298058a795f83d9e86b1b8740617801f5c2bb2cdafb98af33aac792ba89e739/diff",
                "WorkDir": "/var/lib/docker/overlay2/5298058a795f83d9e86b1b8740617801f5c2bb2cdafb98af33aac792ba89e739/work"
            },
            "Name": "overlay2"
        },
        "Mounts": [],
        "Config": {
            "Hostname": "2ecfcc9e27c1",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "12201/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "SEQ_ADDRESS=http://seq:5341",
                "GELF_ENABLE_DIAGNOSTICS=True",
                "GELF_ADDRESS=tcp://0.0.0.0:12201",
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "SEQ_API_KEY="
            ],
            "Cmd": null,
            "Image": "datalust/seq-input-gelf:latest",
            "Volumes": null,
            "WorkingDir": "",
            "Entrypoint": [
                "/run.sh"
            ],
            "OnBuild": null,
            "Labels": {
                "Description": "Seq",
                "Vendor": "Datalust Pty Ltd",
                "com.docker.compose.config-hash": "35e7de6b63a6cd3fb8304fcbda8b2072f1fe0b7d6ee92b40cda9d53fd6fe3f64",
                "com.docker.compose.container-number": "1",
                "com.docker.compose.oneoff": "False",
                "com.docker.compose.project": "laradock",
                "com.docker.compose.service": "seq-input-gelf",
                "com.docker.compose.version": "1.17.1"
            }
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "4500d37476e5e34e9e2a170a08d76b127d137a7d84a682e44e0845828cd12b91",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "12201/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "12201"
                    }
                ]
            },
            "SandboxKey": "/var/run/docker/netns/4500d37476e5",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "",
            "Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "MacAddress": "",
            "Networks": {
                "laradock_default": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": [
                        "2ecfcc9e27c1",
                        "seq-input-gelf"
                    ],
                    "NetworkID": "c397e6ab39dd910f62c93415b1b967137789b7647c3e803e3a1f55d4b65461fc",
                    "EndpointID": "1bc6a7386665d037c02cbe814049cbff412b0cd756749ff6423c113e9a2ff4b2",
                    "Gateway": "172.20.0.1",
                    "IPAddress": "172.20.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:14:00:02",
                    "DriverOpts": null
                }
            }
        }
    }
]

This works and appears in Seq.

curl -XPOST "http://localhost:5341/api/events/raw?clef" -d "{'@t':'2018-06-07T03:44:57.8532799Z','@mt':'Hello, {User}','User':'alice'}"

This returns fine but does not appear in Seq (no STDOUT either, nothing when listening on the port, no error):

echo '{ "version": "1.1", "host": "example.org", "short_message": "A short message", "level": 1, "timestamp": 1557327843, "_some_info": "foo" }' | nc -w1 127.0.0.1 12201

Attempting to use this package: https://github.com/hedii/laravel-gelf-logger also fails. config/logging in Laravel:

        'seq' => [
            'driver' => 'custom',

            'via' => \Hedii\LaravelGelfLogger\GelfLoggerFactory::class,

            // This optional option determines the processors that should be
            // pushed to the handler. This option is useful to modify a field
            // in the log context (see NullStringProcessor), or to add extra
            // data. Each processor must be a callable or an object with an
            // __invoke method: see monolog documentation about processors.
            // Default is an empty array.
            'processors' => [
                \Hedii\LaravelGelfLogger\Processors\NullStringProcessor::class,
                // another processor...
            ],

            // This optional option determines the minimum "level" a message
            // must be in order to be logged by the channel. Default is 'debug'
            'level' => 'debug',

            // This optional option determines the channel name sent with the
            // message in the 'facility' field. Default is equal to app.env
            // configuration value
            'name' => 'example-app',

            // This optional option determines the system name sent with the
            // message in the 'source' field. When forgotten or set to null,
            // the current hostname is used.
            'system_name' => 'laravel',

            // This optional option determines if you want the UDP, TCP or HTTP
            // transport for the gelf log messages. Default is UDP
            'transport' => 'tcp',

            // This optional option determines the host that will receive the
            // gelf log messages. Default is 127.0.0.1
            'host' => '127.0.0.1',

            // This optional option determines the port on which the gelf
            // receiver host is listening. Default is 12201
            'port' => 12201,

            // This optional option determines the path used for the HTTP
            // transport. When forgotten or set to null, default path '/gelf'
            // is used.
            'path' => null,

            // This optional option determines the maximum length per message
            // field. When forgotten or set to null, the default value of
            // \Monolog\Formatter\GelfMessageFormatter::DEFAULT_MAX_LENGTH is
            // used (currently this value is 32766)
            'max_length' => null,

            // This optional option determines the prefix for 'context' fields
            // from the Monolog record. Default is null (no context prefix)
            'context_prefix' => null,

            // This optional option determines the prefix for 'extra' fields
            // from the Monolog record. Default is null (no extra prefix)
            'extra_prefix' => null,
        ],

Logs from Seq (no errors)

seq                    | ────────────────────────────────────────
seq                    |   Seq ♦ Machine data, for humans.
seq                    | ─────────── © 2020 Datalust Pty Ltd ────
seq                    | 
seq                    | Running as server; press Ctrl+C to exit.
seq                    | 
seq                    | [00:51:01 INF] Seq "2020.3.4761" running on OS "Linux 5.4.0-52-generic #57~18.04.1-Ubuntu SMP Thu Oct 15 14:04:49 UTC 2020"
seq                    | [00:51:01 INF] Seq detected 8222.748672 MB of RAM
seq                    | [00:51:03 INF] Seq listening on ["http://localhost/", "http://localhost:5341/"]
seq                    | [00:51:04 INF] Opening event store at "/data/Stream/stream.flare"
seq                    | [00:51:04 INF] Opening metastore "/data/Documents/documents.lmdb"
seq                    | [00:51:04 INF] Cache warm-up is required
seq                    | [00:51:04 INF] Initial memory cache warm-up "completed" in 49.7612 ms
seq                    | [00:51:04 INF] 1 segments warmed up ({"Schemata": 2, "Strings": 0})
seq                    | [00:51:04 INF] Storage subsystem available
seq                    | [00:52:04 INF] 1 more generation 2 garbage collection(s) occurred
seq                    | [00:56:04 INF] Metrics sampled

From within the container:

docker-compose exec seq-input-gelf bash
root@2ecfcc9e27c1:/# curl -X GET http://seq:5341
curl: (6) Could not resolve host: seq

Logs from seq-input-gelf:

seq-input-gelf_1       | {"@t":"2020-10-24T00:04:48.327483112Z","@l":"DEBUG","@mt":"Starting GELF server"}
seq-input-gelf_1       | {"@t":"2020-10-24T00:04:48.329388978Z","@l":"DEBUG","@mt":"Setting up for TCP"}
seq-input-gelf_1       | Failed to send an event batch
seq-input-gelf_1       | System.Net.Http.HttpRequestException: No such device or address ---> System.Net.Sockets.SocketException: No such device or address
seq-input-gelf_1       |    at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
seq-input-gelf_1       |    --- End of inner exception stack trace ---
seq-input-gelf_1       |    at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
seq-input-gelf_1       |    at System.Threading.Tasks.ValueTask`1.get_Result()
seq-input-gelf_1       |    at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
seq-input-gelf_1       |    at System.Threading.Tasks.ValueTask`1.get_Result()
seq-input-gelf_1       |    at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
seq-input-gelf_1       |    at System.Threading.Tasks.ValueTask`1.get_Result()
seq-input-gelf_1       |    at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
seq-input-gelf_1       |    at System.Net.Http.AuthenticationHelper.SendWithAuthAsync(HttpRequestMessage request, Uri authUri, ICredentials credentials, Boolean preAuthenticate, Boolean isProxyAuth, Boolean doRequestAuth, HttpConnectionPool pool, CancellationToken cancellationToken)
seq-input-gelf_1       |    at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
seq-input-gelf_1       |    at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
seq-input-gelf_1       |    at SeqCli.Ingestion.LogShipper.SendBatchAsync(SeqConnection connection, String apiKey, IReadOnlyCollection`1 batch, Boolean logSendFailures) in /home/appveyor/projects/seqcli/src/SeqCli/Ingestion/LogShipper.cs:line 155
seq-input-gelf_1       |    at SeqCli.Ingestion.LogShipper.ShipEvents(SeqConnection connection, String apiKey, ILogEventReader reader, InvalidDataHandling invalidDataHandling, SendFailureHandling sendFailureHandling, Func`2 filter) in /home/appveyor/projects/seqcli/src/SeqCli/Ingestion/LogShipper.cs:line 55
seq-input-gelf_1       | {"@t":"2020-10-24T00:05:48.327737397Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":1},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":1},"server":{"process_err":0,"process_ok":1,"receive_err":0,"receive_ok":1,"tcp_conn_accept":1,"tcp_conn_close":1,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:06:48.328056289Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:07:48.328401615Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | Failed to send an event batch
seq-input-gelf_1       | System.Net.Http.HttpRequestException: No such device or address ---> System.Net.Sockets.SocketException: No such device or address
seq-input-gelf_1       |    at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
seq-input-gelf_1       |    --- End of inner exception stack trace ---
seq-input-gelf_1       |    at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
seq-input-gelf_1       |    at System.Threading.Tasks.ValueTask`1.get_Result()
seq-input-gelf_1       |    at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
seq-input-gelf_1       |    at System.Threading.Tasks.ValueTask`1.get_Result()
seq-input-gelf_1       |    at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
seq-input-gelf_1       |    at System.Threading.Tasks.ValueTask`1.get_Result()
seq-input-gelf_1       |    at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
seq-input-gelf_1       |    at System.Net.Http.AuthenticationHelper.SendWithAuthAsync(HttpRequestMessage request, Uri authUri, ICredentials credentials, Boolean preAuthenticate, Boolean isProxyAuth, Boolean doRequestAuth, HttpConnectionPool pool, CancellationToken cancellationToken)
seq-input-gelf_1       |    at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
seq-input-gelf_1       |    at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
seq-input-gelf_1       |    at SeqCli.Ingestion.LogShipper.SendBatchAsync(SeqConnection connection, String apiKey, IReadOnlyCollection`1 batch, Boolean logSendFailures) in /home/appveyor/projects/seqcli/src/SeqCli/Ingestion/LogShipper.cs:line 155
seq-input-gelf_1       |    at SeqCli.Ingestion.LogShipper.ShipEvents(SeqConnection connection, String apiKey, ILogEventReader reader, InvalidDataHandling invalidDataHandling, SendFailureHandling sendFailureHandling, Func`2 filter) in /home/appveyor/projects/seqcli/src/SeqCli/Ingestion/LogShipper.cs:line 55
seq-input-gelf_1       | {"@t":"2020-10-24T00:08:48.328635883Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":1},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":1},"server":{"process_err":0,"process_ok":1,"receive_err":0,"receive_ok":1,"tcp_conn_accept":1,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:09:48.328914916Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:10:48.329239160Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":1,"tcp_conn_timeout":1,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:11:48.329485601Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:12:48.329734195Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:13:48.329960761Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:14:48.330128423Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:15:48.330304681Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:16:48.330611926Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:17:48.330802587Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | Failed to send an event batch
seq-input-gelf_1       | System.Net.Http.HttpRequestException: No such device or address ---> System.Net.Sockets.SocketException: No such device or address
seq-input-gelf_1       |    at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
seq-input-gelf_1       |    --- End of inner exception stack trace ---
seq-input-gelf_1       |    at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
seq-input-gelf_1       |    at System.Threading.Tasks.ValueTask`1.get_Result()
seq-input-gelf_1       |    at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
seq-input-gelf_1       |    at System.Threading.Tasks.ValueTask`1.get_Result()
seq-input-gelf_1       |    at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask`1 creationTask)
seq-input-gelf_1       |    at System.Threading.Tasks.ValueTask`1.get_Result()
seq-input-gelf_1       |    at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
seq-input-gelf_1       |    at System.Net.Http.AuthenticationHelper.SendWithAuthAsync(HttpRequestMessage request, Uri authUri, ICredentials credentials, Boolean preAuthenticate, Boolean isProxyAuth, Boolean doRequestAuth, HttpConnectionPool pool, CancellationToken cancellationToken)
seq-input-gelf_1       |    at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
seq-input-gelf_1       |    at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
seq-input-gelf_1       |    at SeqCli.Ingestion.LogShipper.SendBatchAsync(SeqConnection connection, String apiKey, IReadOnlyCollection`1 batch, Boolean logSendFailures) in /home/appveyor/projects/seqcli/src/SeqCli/Ingestion/LogShipper.cs:line 155
seq-input-gelf_1       |    at SeqCli.Ingestion.LogShipper.ShipEvents(SeqConnection connection, String apiKey, ILogEventReader reader, InvalidDataHandling invalidDataHandling, SendFailureHandling sendFailureHandling, Func`2 filter) in /home/appveyor/projects/seqcli/src/SeqCli/Ingestion/LogShipper.cs:line 55
seq-input-gelf_1       | {"@t":"2020-10-24T00:18:48.331061506Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":1},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":1},"server":{"process_err":0,"process_ok":1,"receive_err":0,"receive_ok":1,"tcp_conn_accept":1,"tcp_conn_close":1,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:19:48.331239277Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:20:48.331532677Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:21:48.331778979Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:22:48.332102822Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:23:48.332449554Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:24:48.332754494Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:25:48.333062811Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:50:52.543461325Z","@l":"DEBUG","@mt":"Starting GELF server"}
seq-input-gelf_1       | {"@t":"2020-10-24T00:50:52.545627379Z","@l":"DEBUG","@mt":"Setting up for TCP"}
seq-input-gelf_1       | {"@t":"2020-10-24T00:51:52.543752073Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:52:52.543964897Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:53:52.544278253Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:54:52.544553289Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:55:52.544777399Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:56:52.545051947Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:57:52.545264216Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:58:52.545567218Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
seq-input-gelf_1       | {"@t":"2020-10-24T00:59:52.545875615Z","@l":"DEBUG","@mt":"Collected GELF server metrics","process":{"msg":0},"receive":{"chunk":0,"msg_chunked":0,"msg_incomplete_chunk_overflow":0,"msg_unchunked":0},"server":{"process_err":0,"process_ok":0,"receive_err":0,"receive_ok":0,"tcp_conn_accept":0,"tcp_conn_close":0,"tcp_conn_timeout":0,"tcp_msg_overflow":0}}
larenelg commented 4 years ago

Hi @azcoppen

Thanks for getting in touch, and for the detailed information! I was able to reproduce your issue.

The reason why seq-input-gelf cannot see seq is because is not on one of the networks, frontend or backend.

I listed backend as one of the networks under seq-input-gelf and it resolved the issue.

Please let me know, or close this issue, if this also fixes it for you!

Here is my docker-compose.yml for reference :)

version: '3'
services:
    seq-input-gelf:
      image: datalust/seq-input-gelf:latest
      depends_on:
        - seq
      environment:
        GELF_ADDRESS: "tcp://0.0.0.0:12201"
        SEQ_ADDRESS: "http://seq:5341"
        GELF_ENABLE_DIAGNOSTICS: "True"
      ports:
        - "12201:12201"
      networks:
        - backend
      restart: unless-stopped

    seq:
      container_name: seq
      image: datalust/seq:latest
      restart: unless-stopped
      environment:
        - ACCEPT_EULA=y
      ports:
        - "9595:80"
        - "5341:5341"
      networks:
        - frontend
        - backend

networks:
    frontend:
    backend:

Cheers, Larene

alexc-hollywood commented 4 years ago

@larenelg Thanks for the comprehensive and speedy response! Let me run it and see. Going to have a happy dev team if it does!

alexc-hollywood commented 4 years ago

@larenelg You're a legend. Had to switch the default host from '127.0.0.1' to 'seq-input-gelf' though when using docker. Would be great to have a Monolog plugin for the Seq HTTP API. Most devs i know use an external SaaS (pricey) or Graylog (requires Mongo and Elastic).

For others who are looking to implement this, had to make some changes to config/logging.php, so here is the full snippet:

        'seq' => [
            'driver' => 'custom',
            'via' => \Hedii\LaravelGelfLogger\GelfLoggerFactory::class,
            'processors' => [
                \Hedii\LaravelGelfLogger\Processors\NullStringProcessor::class,
            ],
            'level' => env('GELF_MIN_LEVEL', 'debug'),
            'name' => env('GELF_CHANNEL', 'your-app-name'),
            'system_name' => env('GELF_SOURCE', 'laravel'),
            'host' => env('GELF_HOST', '127.0.0.1'), // 'seq-input-gelf' when dockerised, not localhost
            'port' => env('GELF_PORT', 12201),
            'path' => env('GELF_HTTP_PATH', null),
            'max_length' => null,
            'context_prefix' => null,
            'extra_prefix' => null,
        ],
larenelg commented 4 years ago

Thanks for sharing that config @azcoppen - I hope you don't mind if we add a "logging from Laravel" section in our docs with similar config as an example (with due credit, of course!). It's been a while since I've built something using Laravel :)

RE: a Monolog plugin - bandwidth is a little thin on our team at the moment, but it does sound worthwhile! I might have a go at it myself, but if you are feeling like dabbling, here's an easy-to-follow tutorial on how to make a custom Seq Input Apps :) https://docs.datalust.co/docs/writing-custom-inputs

alexc-hollywood commented 4 years ago

Be my guest! It's a bit thin on the ground in terms of docs tbh. This was the only package i found, but it's abandoned: https://github.com/msschl/monolog-seq-handler

I don't want to have to install Mongo/ES for Graylog - we need a nice team solution where we can watch API clients in real time, not have to SSH in for logs, and not send data across the net (even queued).

It makes it a whole new thing IMO. Particularly as you can log to the same place from different types of apps (e.g. Electron, Django, NoSQL DB etc).