Updated S3 API Audit log (markdown)

Konstantin Lebedev 2021-12-14 18:45:41 +05:00
parent 244d9d4ea7
commit e43140f67c

@ -33,46 +33,46 @@
logstash.conf: logstash.conf:
``` ```
filter { filter {
if [tags][0] and [tags][0] =~ /s3.access/ { if [tags][0] and [tags][0] =~ /s3.access/ {
ruby { ruby {
code => 'event.set("environment", ((event.get("tags").first).split(".")).first)' code => 'event.set("environment", ((event.get("tags").first).split(".")).first)'
add_field => { "[@metadata][input_type]" => "s3.access" } add_field => { "[@metadata][input_type]" => "s3.access" }
remove_field => [ host, "@timestamp", "@version", port, tags ] remove_field => [ host, "@timestamp", "@version", port, tags ]
} }
} }
if ![environment] or [environment] == "" { if ![environment] or [environment] == "" {
mutate { mutate {
replace => { "environment" => "unknown" } replace => { "environment" => "unknown" }
} }
} }
} }
input { input {
tcp { tcp {
codec => fluent codec => fluent
port => 24224 port => 24224
} }
} }
output { output {
if [@metadata][input_type] == "s3.access" { if [@metadata][input_type] == "s3.access" {
clickhouse { clickhouse {
headers => ["Authorization", "Basic ${CLICKHOUSE_BASIC_AUTH}"] headers => ["Authorization", "Basic ${CLICKHOUSE_BASIC_AUTH}"]
http_hosts => ["${CLICKHOUSE_URL}", "${CLICKHOUSE_URL}"] http_hosts => ["${CLICKHOUSE_URL}", "${CLICKHOUSE_URL}"]
table => "${CLICKHOUSE_TABLE}" table => "${CLICKHOUSE_TABLE}"
flush_size => 1000 flush_size => 1000
pool_max => 1000 pool_max => 1000
idle_flush_time => 5 idle_flush_time => 5
backoff_time => 3 backoff_time => 3
request_tolerance => 5 request_tolerance => 5
automatic_retries => 1 automatic_retries => 1
save_on_failure => true save_on_failure => true
save_dir => "${CLICKHOUSE_SAVE_DIR}" save_dir => "${CLICKHOUSE_SAVE_DIR}"
date_time_input_format => "best_effort" date_time_input_format => "best_effort"
skip_unknown => "1" skip_unknown => "1"
id => "clickhouse" id => "clickhouse"
} }
} }
} }
``` ```