Logging with elixir and elasticsearch

i am working on a phoenix application, and i want to get logs stored in elasticsearch.

it is possible to do that with maybe some elixir libraries or some functions ?

if that true, can some one givs me some ideas please !

Yes, it is. There are 2 approaches possible:

  • Easy: Use syslog/journal/file logging and then dispatch logs to the ES (or any other service) from there
  • Medium: Implement Elixir Logger Backend (or find existing one)
  • Hard: Implement Erlang Logger Handler (I doubt that you will find one that is already done)
1 Like

i am trying to use the Medium way, i searched for it and i found this documentation: Logger — Logger v1.11.4 (hexdocs.pm) . But i didn’t understand it very well, maybe i didn’t clarify what i want exactly. i need firstval to connect to elasticsearch using the correct URL + port number + username + password, then get logs from there and display them in my application.
that’s possible with the approaches you sended ? ( i appreciate your help thanks)

Oh, I have read it as you want to send logs to the ES, as otherwise it has nothing to do with the logging. What you are looking for is how to query ElasticSearch, and for that you have some Hex packages. Now you need to pick any of them that will work for you and just query the DB fetching data you need.

However it still has nothing to do with logging, as the source of the data and kind of data you are trying to fetch is irrelevant there.


oh yeah, i knew it i didn’t correctly express for what i want i am sorry about that, so i will try using the Hex packages.
thanks a lot.