Logging to ElasticSearch (or any other destination)
Create a platformatic application
Create a platformatic application using
Setup ElasticSearch and Kibana
If you are logging to ElasticSearch and visualizing with Kibana, you might want to set it up using Docker Compose for local testing.
Write the following as
# Elasticsearch 8.x has HTTPS and auth on by default. This option is
# needed to use HTTP and no auth (as used in the tests).
Then, start ElasticSearch and Kibana with
docker-compose -f docker-compose.yml up.
npm i pino-elasticsearch
Configure Logger Transport
Configuring your platformatic application to log to ElasticSearch is straighforward, you just have to configure it like the following:
This snippet can be applied either to the
for Platformatic Runtime applications, or as part of the applicaiton configuration
for any other application.
This setup will allow you to log both to the terminal (TTY) and to ElasticSearch at the same time.
Start your server with
platformatic start, and navigate across
http://localhost:5601in your browser
- Click on the hamburger menu on top left, and then "Discover"
- Click on the "Create Data View"
timeas timestamp field
- Enjoy your logs