feat: add comprehensive access logging to Graylog with GeoIP

- Add fluent-bit inputs for Caddy access logs (JSON) and SSH logs
- Create GeoIP task to download MaxMind GeoLite2-City database
- Mount GeoIP database in Graylog container
- Enable Gitea access logging via environment variables
- Add parsers.conf for Caddy JSON log parsing
- Remove unused nosql/redis container and configuration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Bastian de Byl
2026-01-09 15:16:21 -05:00
parent 8685676109
commit 6af3c5dc69
10 changed files with 167 additions and 58 deletions

View File

@@ -0,0 +1,59 @@
---
# Download MaxMind GeoLite2 database for Graylog GeoIP enrichment
# Requires free MaxMind account: https://dev.maxmind.com/geoip/geolite2-free-geolocation-data
- name: create geoip directory
become: true
ansible.builtin.file:
path: "{{ geoip_path }}"
state: directory
owner: "{{ podman_subuid.stdout }}"
group: "{{ podman_subuid.stdout }}"
mode: '0755'
notify: restorecon podman
tags: graylog, geoip
- name: download GeoLite2 database
become: true
ansible.builtin.get_url:
url: "https://download.maxmind.com/geoip/databases/{{ geoip_database_edition }}/download?suffix=tar.gz"
dest: "{{ geoip_path }}/{{ geoip_database_edition }}.tar.gz"
url_username: "{{ geoip_maxmind_account_id }}"
url_password: "{{ geoip_maxmind_license_key }}"
force: false
mode: '0644'
register: geoip_download
tags: graylog, geoip
- name: extract GeoLite2 database
become: true
ansible.builtin.unarchive:
src: "{{ geoip_path }}/{{ geoip_database_edition }}.tar.gz"
dest: "{{ geoip_path }}"
remote_src: true
extra_opts:
- --strip-components=1
- --wildcards
- "*/{{ geoip_database_edition }}.mmdb"
when: geoip_download.changed
tags: graylog, geoip
# Fix ownership of downloaded files to podman user's subuid range
- name: fix geoip files ownership for podman user
become: true
ansible.builtin.file:
path: "{{ geoip_path }}"
state: directory
owner: "{{ podman_subuid.stdout }}"
group: "{{ podman_subuid.stdout }}"
recurse: true
tags: graylog, geoip
# Graylog runs as UID 1100 inside the container
- name: fix geoip database ownership for graylog container
become: true
become_user: "{{ podman_user }}"
changed_when: false
ansible.builtin.command: |
podman unshare chown -R 1100:1100 {{ geoip_path }}
tags: graylog, geoip