check / check (push) Failing after 3m27s
Every setting of discriminator and rproxy is read through viper, in place of the os.LookupEnv function Main passed down. NewViper turns AutomaticEnv and AllowEmptyEnv on, so a setting that is set but empty reads as set. A setting may also be given as a file, the _FILE form, which rproxy's settings now have too; rproxy still writes nothing to disk. The settings are renamed. Discriminator's take the prefix SWW_WAF_, rproxy's take SWW_RPROXY_, and the shared SWW_COMMAND keeps SWW_. The Core Rule Set's settings take SWW_WAF_CORE_RULE_SET_ rather than SWW_WAF_WAF_. Every place a name appeared changed: the code, the viper keys, tests, documents, examples, the README's settings table and the image files. Model: deepseek-v4-pro
3.0 KiB
3.0 KiB
The metrics
What GET /_sww/metrics answers with, at discriminator's own address.
"Metrics endpoint" in SPEC.md describes the endpoint. Prometheus
keeps the instance label as exported_instance unless the scrape sets
honor_labels: true. rproxy has no metrics.
Traffic
sww_requests_total,sww_request_bytes_totalandsww_response_bytes_total, bystatus_classsuch as2xxand byaction;sww_request_duration_secondsandsww_upstream_duration_seconds, as histograms;sww_requests_in_flight: the questions and requests to its own endpoints thatdiscriminatoris handling.
Limits and bans
sww_rate_limit_hits_total, bywindowand bykind(requests,bytesorrefusals);sww_offences_total, bykind;sww_bans_made_total, bycause;sww_active_bansandsww_permanent_bans.
Attack detection
sww_rule_matches_total, byrule_idandaction, andsww_rules_loaded;sww_waf_matches_total, bymodeandrule_id, for the rules that fired.
Countries and AS numbers
For the SWW_WAF_METRICS_TOP_N busiest of each, the rest as other:
sww_country_requests_total,sww_country_request_bytes_total,sww_country_response_bytes_totalandsww_country_list_refusals_total, bycountry;sww_asn_requests_total,sww_asn_request_bytes_totalandsww_asn_response_bytes_total, byasn.
Lookups
sww_geojs_requests_totalandsww_geojs_failures_total;sww_geojs_unanswered_total: the requests that needed an answer and went on without it;- with the file source,
sww_lookup_database_last_read_timestamp_secondsandsww_lookup_database_read_failures_total.
Reputation sources
By source: each list's URL, each zone, and abuseipdb:
sww_reputation_hits_total,sww_reputation_queries_totalandsww_reputation_failures_total;sww_reputation_last_fetch_timestamp_seconds, for a list;sww_reputation_daily_budget_remaining, for AbuseIPDB.
State files
By file:
sww_state_file_writes_total,sww_state_file_write_failures_total,sww_state_file_last_write_timestamp_secondsandsww_state_file_size_bytes;sww_state_file_edits_taken_in_totalandsww_state_file_edits_set_aside_total;sww_tracked_clients: the clients in the table.
Remote log, alerts and the process
- while a syslog server is set,
sww_remote_log_lines_sent_total,sww_remote_log_lines_dropped_totalandsww_remote_log_buffer_depth; - by
destination,sww_alerts_sent_total,sww_alerts_failed_total,sww_alerts_suppressed_totalandsww_alerts_dropped_total; - Go's own
go_metrics and the process'sprocess_metrics.
When a request is counted
discriminator counts a denied request at its decision, and a request to its
own endpoints when it is answered. It counts an allowed request when its report
comes, with the status, bytes and times the report gives. These are not counted:
- a report itself;
- an allowed request whose report never comes;
- a question refused with
400; - a question whose body stopped arriving.