diff --git a/fluentbit-values.yaml b/fluentbit-values.yaml index 97c4fe3..8906afb 100644 --- a/fluentbit-values.yaml +++ b/fluentbit-values.yaml @@ -193,6 +193,14 @@ config: ## https://docs.fluentbit.io/manual/pipeline/inputs inputs: | + [INPUT] + Name tail + Path /var/log/containers/ingress-nginx-ingress-controller-*.log + Parser docker + Tag nginx-ingress.* + Mem_Buf_Limit 4Mb + Skip_Long_Lines Off + [INPUT] Name tail Path /var/log/containers/*.log @@ -230,6 +238,16 @@ config: # } # } filters: | + [FILTER] + Name kubernetes + Match nginx-ingress.* + Buffer_Size 128KB + Merge_Parser k8s-nginx-ingress + Merge_Log On + Keep_Log Off + K8S-Logging.Parser On + K8S-Logging.Exclude On + [FILTER] Name kubernetes Match kube.* @@ -238,10 +256,11 @@ config: Keep_Log Off K8S-Logging.Parser On K8S-Logging.Exclude On + ## filter order matteres [FILTER] Name geoip2 - Match kube.* + Match nginx-ingress.* Database /mnt/GeoLite2-City.mmdb Lookup_key host Record city host %{city.names.en} @@ -251,11 +270,27 @@ config: Record country_name host %{country.names.en} # Record postal_code host %{postal.code} Record region_code host %{subdivisions.0.iso_code} - # Record region_name host %{subdivisions.0.names.en} - + Record region_name host %{subdivisions.0.names.en} + [FILTER] + Name lua + Match nginx-ingress.* + script /mnt/generate-location.lua + call generate_location ## https://docs.fluentbit.io/manual/pipeline/outputs outputs: | + [OUTPUT] + Name es + Match nginx-ingress.* + Host elasticsearch.es.svc.cluster.local + Port 9200 + Index geo-nginx-ingress.%Y + Retry_Limit 10 + Buffer_Size 1024KB + Trace_Error On + Replace_Dots On + Suppress_Type_Name On + [OUTPUT] Name es Match kube.* diff --git a/generate-location.lua b/generate-location.lua new file mode 100644 index 0000000..b0c509e --- /dev/null +++ b/generate-location.lua @@ -0,0 +1,6 @@ +function generate_location(tag, timestamp, record) + if record["latitude"] ~= nil then + record["location"] = record["latitude"] .. "," .. record["longitude"] + end + return 2, timestamp, record +end