Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Monitor PostgreSQL with the Elastic Stack

Monitor PostgreSQL with the Elastic Stack

How to use the Elastic Stack (previously called ELK Stack) to monitor logs is widely known. But it can also give you a complete picture of your PostgreSQL installation:
* System metrics: Keep track of network traffic and system load.
* Logs: Collect and parse PostgreSQL logs.
* PostgreSQL metrics: Gather the most relevant attributes with the dedicated Metricbeat module.
* Queries: Monitor your queries on the wire without instrumenting PostgreSQL with Packetbeat.

And we will do all of that live since it is so easy and much more interactive that way.

Philipp Krenn

July 05, 2017
Tweet

More Decks by Philipp Krenn

Other Decks in Programming

Transcript

  1. 5

  2. 7

  3. 8

  4. 10

  5. 11

  6. 12

  7. 13

  8. 15

  9. 16

  10. 17

  11. 24

  12. 26

  13. 28

  14. 32

  15. 36

  16. 37

  17. /etc/logstash/conf.d/20-elasticsearch- output.conf output { elasticsearch { hosts => ["localhost:9200"] manage_template

    => false index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}" document_type => "%{[@metadata][type]}" user => "elastic" password => "changeme" } } 40
  18. 43

  19. /etc/logstash/conf.d/10-postgresql- filter.conf filter { if [type] == "postgresql" { grok

    { match => { "message" => "%{DATESTAMP:timestamp} %{TZ} (\[%{DATA:group_id}\]) (\[?%{DATA:user}\]?@\[?%{DATA:database}\]? )?%{DATA:level}: %{GREEDYDATA:msg}" } } } } 44
  20. 58

  21. /etc/metricbeat/metricbeat.yml - module: postgresql metricsets: - database - bgwriter -

    activity enabled: true period: 10s hosts: ["postgres://localhost:5432?sslmode=disable"] username: elastic password: changeme 62
  22. 65

  23. 67

  24. Flows Application layer: Unsupported / encrypted (TLS) protocols IP /

    TCP / UDP Number of packets & bytes Retransmissions Temporal flow 70
  25. 74

  26. 81

  27. 84

  28. 88

  29. 89

  30. 90