7,540
edits
Changes
→Bevezető
=Metrikák gyűjtése logokból=
==BevezetőOverview==Az a feladat, hogy The task is to process the access log of HAproxy with a HAproxy access logját egy log értelmezővel feldolgozzuk, és abból interpreter and generate Prometheus metrikákat képezzünk, amit egy végponton elérhetővé kell tenni a metrics that must be made available to Prometheus számáraat an endpoint. Erre a '''We will use the grok-exporter''' eszközt fogjuk használnitool, ami ezt egy személyben meg tudja valósítaniwhich can do this in one person. A logokat fájlból vagy It can read logs from a file or stdin-ről képes felolvasni, és abból képes metrikákat képezniand generate metrics from it. A The grok-exporter will receive the logs from HAproxy via a logokat egy mellé csomagolt packaged rsyslog szerveren keresztül fogja megkapni a HAproxy-tólserver. Az rsyslog lerakja fájlba a logokat, ahonnan Rsyslog puts logs into a file from which grok-exporter fel fogja tudni olvasniwill be able to read them. A grokGrok-exporter converts logs into promethues metrikákká alakítja a logokatmetrics.
* Létre kell hozni egy olyan You need to create a docker image-t a from grok-exporter-ből, amiben van that has rsyslog is. A konténernek tudnia kell The container must be able to run rsyslog as root-ként futtatni az rsyslogot, ez which requires extra openShfit konfigurációt igényelconfiguration. * A The grok-exporter image-t úgy kell futtatni must be run on OpenShfit-en, hogy egyrészt a with both the grok-exporter konfigurációja egy configuration configured in ConfigMap legyen, másrészt az and the rsyslog munkaterülete egy workspace with an OpenSfhit volume legyen. * A For grok-exporter deployment, you need to create a ClasterIP-hez létre kell hozni egy ClasterIP típusú type service-t, ami képes that can perform load-balancing-ot végezni a between grok-exporter pod-ok közöttpods. * A routerekben Routers (HAproxy) should be kell állítani, hogy configured to log in debug módban logoljanak, és az így előálló mode and send the resulting access log-ot küldje el a to port 514 of the grok-exporter service 514-es portjára. * A The rsyslog server running on the grok-exporter pod-ban futó rsyslog szerver a megkapott puts the received HAproxy access logokat egyrészt lerakja a logs into the file '''/var/log/messages''' fájlba (emptyDir típusú type volume) másrészt elküldi az and sends it to'''stdout'''-ra is. * Az Logs written to stdout-ra írt logokat a dokcerwill be collected by the doc-log-driver fel fogja szedni, és továbbítani fogja a centralizált and forwarded to the centralized log architektúra feléarchitecture. * A The grok-exporter program olvassa a reads '''/var/log/messages''' fájlt, a benne lévő generates prometheus metrics from its HAproxy access-log-okból prometheus metrikákat képezlogs. * A The configuration of promethues konfigurációját úgy kell kialakítani, hogy should be configured to use '''kubernetes_sd_configs''' segítségével közvetlen a to directly invoke the grok-proxy pod-okat szólítsa meg a metrika begyűjtéséhezpods to collect the metric, ne a not to go through the service-en keresztül menjen, hogy kikerülje a to bypass load-balancing-ot, mivel minden since everything pod-ot le kell kérdeznineeds to be queried.
<br>