grafana / loki

Like Prometheus, but for logs.
https://grafana.com/loki
GNU Affero General Public License v3.0
23.64k stars 3.42k forks source link

promtail crash when update geoip db file #9335

Open Trevelian opened 1 year ago

Trevelian commented 1 year ago

Describe the bug Promtail / Loki version 2.8.1 on Archlinux When updating the geoip db file, promtail crash

To Reproduce

Promtail geoip configuration :

      - geoip:
          db: "/etc/loki/GeoLite2-City.mmdb"
          source: "src_ip"
          db_type: "city"

Update the db file :

scp /tmp/GeoLite2-City.mmdb vm-loki:/etc/loki/GeoLite2-City.mmdb

promtail crash

Expected behavior Update the db file don't crash promtail, he open the new db file when it change

Environment:

wilsomrm2 commented 1 year ago

Same for me.

ansibleguy commented 10 months ago

Just to give my opinion: The stage should just not create the geoip_* labels if the database is not available. (without crashing the whole pipeline) Other extractions like regex do exactly that.

superstes commented 10 months ago

The error I'm seeing is invalid geoip stage config: open /etc/geoip/city.mmdb: no such file or directory I tracked its source to here: https://github.com/grafana/loki/blob/main/clients/pkg/logentry/stages/geoip.go#L91