logdyhq / logdy-core

Web based real-time log viewer. Stream ANY content to a web UI with autogenerated filters. Parse any format with TypeScript.

Home Page:https://logdy.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

port forward is not working

usUpal opened this issue · comments

my another application is running on port 8080; so I tried to forward to the 8081 port but it showing this error. can anyone help? my port 8081 is free. I checked.
command:
pm2 logs 1 | logdy forward 8081
error:

INFO[20:22:24.905] Accept stdin and forward to port              port=8081
ERRO[20:22:24.905] Error while connecting to port                error="dial tcp :8081: connect: connection refused"
panic: dial tcp :8081: connect: connection refused

goroutine 1 [running]:
logdy/modes.ConsumeStdinAndForwardToPort({0x0, 0x0}, {0x7ffffcf896ae, 0x4})
        /Users/peter/projects/cf/logdyhq/logdy-core/modes/forward.go:20 +0x445
main.glob..func6(0xc0000c7100?, {0xc0000ae3b0, 0x1, 0x9109f2?})
        /Users/peter/projects/cf/logdyhq/logdy-core/main.go:128 +0x49
github.com/spf13/cobra.(*Command).execute(0x26c0e00, {0xc0000ae380, 0x1, 0x1})
        /Users/peter/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:987 +0xaa3
github.com/spf13/cobra.(*Command).ExecuteC(0x26c0560)
        /Users/peter/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        /Users/peter/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
main.main()
        /Users/peter/projects/cf/logdyhq/logdy-core/main.go:195 +0x53
node:events:496
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at afterWriteDispatched (node:internal/stream_base_commons:160:15)
    at writeGeneric (node:internal/stream_base_commons:151:3)
    at Socket._writeGeneric (node:net:952:11)
    at Socket._write (node:net:964:8)
    at writeOrBuffer (node:internal/streams/writable:564:12)
    at _write (node:internal/streams/writable:493:10)
    at Writable.write (node:internal/streams/writable:502:10)
    at console.value (node:internal/console/constructor:304:16)
    at console.log (node:internal/console/constructor:379:26)
    at /usr/local/lib/node_modules/pm2/lib/API/Log.js:56:15
Emitted 'error' event on Socket instance at:
    at emitErrorNT (node:internal/streams/destroy:169:8)
    at emitErrorCloseNT (node:internal/streams/destroy:128:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}

Node.js v20.11.0

Hi @usUpal,
what are you trying to achieve? Logdy forward will forward all STDIN line to a specific port.
The error message panic: dial tcp :8081: connect: connection refused means that nothing is accepting a connection on port 8081.
You can start Logdy with logdy socket 8081, more here.

thanks for the quick reply @PeterOsinski . logdy's default port is 8080; what I am trying to achieve is run logdy in different port? can you pls tell me how can I do that?
image

The port 8080 is used to serve a UI, you can change it with --port option, for example:
logdy --port=8082
The setup you presented on a screenshot could be easily achieved with:
pm2 logs 1 | logdy --port=8082

If you'd like to stream multiple pm2 logs to logdy you can use tips from this blog post.
Let me know if that helps!

thanks, It worked. It wasn't an issue actually 😂