Disable writing logs to files and get logs by tcp/http/websockets

Hi. I use Nomad for running docker instances as well as running go binaries. I want to have a unified way to get logs from nomad without writing it to file.

My requirements are:

  1. Nomad should not write logs to file (I don’t want any agents on the same machine)
  2. Services running under nomad must write logs to stdout (I don’t want services to write logs directly to logstash)
  3. Be able to get all the logs by one of the protocols: tcp, udp, websockets (for now I’m pulling logs from nomad’s HTTP streaming API)

It would be nice if nomad could send logs to an configurable writable interface. It doesn’t really must know if the logs sent to file or to network… if we use interfaces…

If it isn’t possible, can I use websockets API to get the logs? And again, nomad should not write files…

Thanks!

fwiw, Docker supports sending logs directly to a central rsyslog server (which I guess is OK for your requirement)

for the raw_exec method, there isn’t any Nomadic way, though you could wrap the execution around the logger command to send output to syslog -> which then send to a central log server.

1 Like

Hi @spaiz! The advice @shantanugadgil gave you here is all solid, but you won’t be able to use the websocket log streaming endpoint as that is streaming out the files on disk (using the same mechanism we use for file system exploration). In the future, we’re planning on implementing some kind of log streaming plugin interface. See https://github.com/hashicorp/nomad/issues/1469