Skip to content

Commit

Permalink
update logstash filters for alb_access logs
Browse files Browse the repository at this point in the history
Hopefully this gets rid of the cruft that the cloudfoundry pipelines
add.
  • Loading branch information
whi-tw authored and risicle committed Aug 30, 2023
1 parent fa81aa4 commit 8d55654
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
6 changes: 4 additions & 2 deletions config/logit/filters.d/10_base.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
mutate {
add_field => [ "type", "syslog" ]
if [type] != 'alb_access' {
mutate {
add_field => [ "type", "syslog" ]
}
}

#
Expand Down
14 changes: 14 additions & 0 deletions config/logit/filters.d/99_clean_alb_access.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#
# Fix up the datapoints for the alb_access log type
#
if [@input] == "alb_access" {
## remove extraneous fields
mutate {
remove_field => [ '[@shipper][name]', '[@source][component]', '[@source][type]' ]
}

## set @type
mutate {
replace => { "@type" => "alb_access" }
}
}
20 changes: 18 additions & 2 deletions config/logit/output/generated_logit_filters.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
filter {
mutate {
add_field => [ "type", "syslog" ]
if [type] != 'alb_access' {
mutate {
add_field => [ "type", "syslog" ]
}
}

#
Expand Down Expand Up @@ -1329,4 +1331,18 @@ filter {
match => [ "[vxlan_policy_agent][timestamp]", "dd/MMMM/yyyy:HH:mm:ss Z", "dd/MMM/yyyy:HH:mm:ss Z", "ISO8601", "UNIX" ]
target => "@timestamp"
}
#
# Fix up the datapoints for the alb_access log type
#
if [@input] == "alb_access" {
## remove extraneous fields
mutate {
remove_field => [ '[@shipper][name]', '[@source][component]', '[@source][type]' ]
}

## set @type
mutate {
replace => { "@type" => "alb_access" }
}
}
}
1 change: 1 addition & 0 deletions scripts/generate_logit_filters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ echo "filter {" > /output/generated_logit_filters.conf
sed 's/^/ /' < /mnt/config/logit/filters.d/20_custom_cf_filters.conf
sed 's/^/ /' < /mnt/config/logit/filters.d/21_paas_billing_filters.conf
sed 's/^/ /' < /mnt/config/logit/filters.d/30_various_timestamps.conf
sed 's/^/ /' < /mnt/config/logit/filters.d/99_clean_alb_access.conf
echo "}"
} >> /output/generated_logit_filters.conf

Expand Down

0 comments on commit 8d55654

Please sign in to comment.