Skip to content

Commit c88d10d

Browse files
authored
Merge pull request #61 from mcollina/elasticsearch
README docs for elasticsearch
2 parents d707fd5 + 1e28379 commit c88d10d

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,27 @@ Using transports in the same process causes unnecessary load and slows down Node
728728

729729
If you write a transport, let us know and we will add a link here!
730730

731+
<a name="pino-elasticsearch"></a>
732+
### pino-elasticsearch
733+
734+
[pino-elasticsearch][pino-elasticsearch] uploads the log lines in bulk
735+
to [ElasticSearch][elasticsearch], to be displayed in [Kibana][kibana].
736+
737+
It is extremely simple to use and setup
738+
739+
```sh
740+
$ node yourapp.js | pino-elasticsearch --host 192.168.1.42
741+
```
742+
743+
Assuming ElasticSearch is running on 192.168.1.42.
744+
745+
Then, head to your
746+
Kibana instance, and create an index pattern
747+
(https://www.elastic.co/guide/en/kibana/current/setup.html) on `'pino'`,
748+
the default for `pino-elasticsearch`.
749+
750+
[pino-elasticsearch]: https://github.com/mcollina/pino-elasticsearch
751+
731752
<a name="pino-socket"></a>
732753
### pino-socket
733754

@@ -746,6 +767,44 @@ $ node yourapp.js | pino-socket -p 6000
746767

747768
You should see the logs from your application on both consoles.
748769

770+
#### Logstash
771+
772+
You can also use [pino-socket][pino-socket] to upload logs to
773+
[LogStash][logstash] via:
774+
775+
```
776+
$ node yourapp.js | pino-socket -a 127.0.0.1 -p 5000 -m tcp
777+
```
778+
779+
Assuming your logstash is running on the same host and configured as
780+
follows:
781+
782+
```
783+
input {
784+
tcp {
785+
port => 5000
786+
}
787+
}
788+
789+
filter {
790+
json {
791+
source => "message"
792+
}
793+
}
794+
795+
output {
796+
elasticsearch {
797+
hosts => "127.0.0.1:9200"
798+
}
799+
}
800+
```
801+
802+
See https://www.elastic.co/guide/en/kibana/current/setup.html to learn
803+
how to setup [Kibana][kibana].
804+
805+
If you are a Docker fan, you can use
806+
https://github.com/deviantony/docker-elk to setup an ELK stack.
807+
749808
[pino-socket]: https://www.npmjs.com/package/pino-socket
750809

751810
<a name="caveats"></a>
@@ -829,3 +888,6 @@ This project was kindly sponsored by [nearForm](http://nearform.com).
829888
## License
830889

831890
Licensed under [MIT](./LICENSE).
891+
892+
[elasticsearch]: https://www.elastic.co/products/elasticsearch
893+
[kibana]: https://www.elastic.co/products/kibana

0 commit comments

Comments
 (0)