Where do logs wind up in prod?

A somewhat embarassing question – where do logs wind up in prod (system: ubuntu 18.04)?

I noticed that /var/log/syslog seems to be logging some elixir events, but they don’t contain meaningful string messages, just the metadata (or at least so it seems).

Thanks for the help in advance!

Hi @ityonemo!

This would depend upon how you have deployed your application. Could you share more information about your setup?



Right. things have changed around logging recently =D

OTP/22; 1.10.2

I just standard MIX_ENV=prod mix release <release name> deliver by untarring to /dir/to/release and use systemd to launch:

Description=My App

ExecStart=/dir/to/release/bin/release start
ExecStop=/dir/to/release/bin/release stop


in config.exs, i have:

config :logger, :console,
  format: "$time $metadata[$level] $message\n",
  metadata: [:request_id],
  colors: [error: [:bright, :light_red]]

in prod.exs, I have:

config :logger, backends: [:console]

should I be adding extra logger backends to get them to durable filesystem?

I’m not the most familiar with systemd but it has it’s own logging system called journald.

I’m on my phone now so I can’t look up the exact command but if I’m correct you should be able to view the logs from your systemd unit with the journalctl program.

Yep, got it. thanks! Haha I just don’t linux system admin enough to remember that, but it’s not a command I’ve never run before =D

As you are logging to console then the data ended in journal as @lpil said. You can check them by journalctl -u my_app.service. Just in case, if you want better support for journal logs then you can check out my systemd library which provides some handy utilities.

1 Like

I wish I could give solution to both of you, but I think I’m going to give it to @hauleth to mark down the appropriate command for future users.