# ============================================================================= # WOOO TECH - Momo Pro System # Promtail Configuration # ============================================================================= server: http_listen_port: 9080 grpc_listen_port: 0 positions: filename: /tmp/positions.yaml clients: - url: http://loki:3100/loki/api/v1/push scrape_configs: # ========================================================================== # Flask/Gunicorn Application Logs # ========================================================================== - job_name: momo-app static_configs: - targets: - localhost labels: job: momo-app env: production __path__: /var/log/app/*.log pipeline_stages: - multiline: firstline: '^\d{4}-\d{2}-\d{2}' max_wait_time: 3s - regex: expression: '^(?P\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3}) - (?P\w+) - (?P.*)$' - labels: level: - timestamp: source: timestamp format: '2006-01-02 15:04:05,000' # ========================================================================== # Gunicorn Access Log # ========================================================================== - job_name: gunicorn-access static_configs: - targets: - localhost labels: job: gunicorn-access env: production __path__: /var/log/app/gunicorn-access.log pipeline_stages: - regex: expression: '^(?P\S+) - - \[(?P[^\]]+)\] "(?P\S+) (?P\S+) (?P\S+)" (?P\d+) (?P\d+) "(?P[^"]*)" "(?P[^"]*)"' - labels: method: status: path: # ========================================================================== # Gunicorn Error Log # ========================================================================== - job_name: gunicorn-error static_configs: - targets: - localhost labels: job: gunicorn-error env: production __path__: /var/log/app/gunicorn-error.log pipeline_stages: - multiline: firstline: '^\[\d{4}-\d{2}-\d{2}' max_wait_time: 3s # ========================================================================== # Nginx Access Log # ========================================================================== - job_name: nginx-access static_configs: - targets: - localhost labels: job: nginx-access env: production __path__: /var/log/nginx/*access*.log pipeline_stages: - regex: expression: '^(?P\S+) - (?P\S+) \[(?P[^\]]+)\] "(?P\S+) (?P\S+) (?P\S+)" (?P\d+) (?P\d+) "(?P[^"]*)" "(?P[^"]*)"' - labels: method: status: - metrics: http_request_total: type: Counter description: "Total HTTP requests" source: status config: action: inc # ========================================================================== # Nginx Error Log # ========================================================================== - job_name: nginx-error static_configs: - targets: - localhost labels: job: nginx-error env: production __path__: /var/log/nginx/*error*.log pipeline_stages: - multiline: firstline: '^\d{4}/\d{2}/\d{2}' max_wait_time: 3s