Skip to content

Commit 5d72a98

Browse files
committed
logit filters: improve handling of alb_access logs
1 parent 51d869f commit 5d72a98

File tree

3 files changed

+72
-4
lines changed

3 files changed

+72
-4
lines changed

config/logit/filters.d/30_various_timestamps.conf

+5
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,8 @@ date {
116116
match => [ "[vxlan_policy_agent][timestamp]", "dd/MMMM/yyyy:HH:mm:ss Z", "dd/MMM/yyyy:HH:mm:ss Z", "ISO8601", "UNIX" ]
117117
target => "@timestamp"
118118
}
119+
# alb_access
120+
date {
121+
match => [ "[event][end]", "dd/MMMM/yyyy:HH:mm:ss Z", "dd/MMM/yyyy:HH:mm:ss Z", "ISO8601", "UNIX" ]
122+
target => "@timestamp"
123+
}

config/logit/filters.d/99_clean_alb_access.conf

+31-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,42 @@
22
# Fix up the datapoints for the alb_access log type
33
#
44
if [@input] == "alb_access" {
5+
grok {
6+
match => ["[file][path]", "^(?<deploy_env>[^/]+)"]
7+
tag_on_failure => ["fail/deploy_env/_grokparsefailure"]
8+
}
9+
510
## remove extraneous fields
611
mutate {
7-
remove_field => [ '[@shipper][name]', '[@source][component]', '[@source][type]' ]
12+
remove_field => [
13+
'[source][geo][city_name]',
14+
'[source][geo][continent_code]',
15+
'[source][geo][country_code2]',
16+
'[source][geo][country_code3]',
17+
'[source][geo][country_name]',
18+
'[source][geo][ip]',
19+
'[source][geo][latitude]',
20+
'[source][geo][location][lat]',
21+
'[source][geo][location][lon]',
22+
'[source][geo][longitude]',
23+
'[source][geo][postal_code]',
24+
'[source][geo][region_code]',
25+
'[source][geo][region_name]',
26+
'[source][geo][timezone]',
27+
'[device]',
28+
'[name]',
29+
'[os]',
30+
'[os_name]',
31+
'[@shipper][name]',
32+
'[@source][type]'
33+
]
834
}
935

1036
## set @type
1137
mutate {
12-
replace => { "@type" => "alb_access" }
38+
replace => {
39+
"@type" => "alb_access"
40+
"[@source][component]" => "alb_access"
41+
}
1342
}
1443
}

config/logit/output/generated_logit_filters.conf

+36-2
Original file line numberDiff line numberDiff line change
@@ -1331,18 +1331,52 @@ filter {
13311331
match => [ "[vxlan_policy_agent][timestamp]", "dd/MMMM/yyyy:HH:mm:ss Z", "dd/MMM/yyyy:HH:mm:ss Z", "ISO8601", "UNIX" ]
13321332
target => "@timestamp"
13331333
}
1334+
# alb_access
1335+
date {
1336+
match => [ "[event][end]", "dd/MMMM/yyyy:HH:mm:ss Z", "dd/MMM/yyyy:HH:mm:ss Z", "ISO8601", "UNIX" ]
1337+
target => "@timestamp"
1338+
}
13341339
#
13351340
# Fix up the datapoints for the alb_access log type
13361341
#
13371342
if [@input] == "alb_access" {
1343+
grok {
1344+
match => ["[file][path]", "^(?<deploy_env>[^/]+)"]
1345+
tag_on_failure => ["fail/deploy_env/_grokparsefailure"]
1346+
}
1347+
13381348
## remove extraneous fields
13391349
mutate {
1340-
remove_field => [ '[@shipper][name]', '[@source][component]', '[@source][type]' ]
1350+
remove_field => [
1351+
'[source][geo][city_name]',
1352+
'[source][geo][continent_code]',
1353+
'[source][geo][country_code2]',
1354+
'[source][geo][country_code3]',
1355+
'[source][geo][country_name]',
1356+
'[source][geo][ip]',
1357+
'[source][geo][latitude]',
1358+
'[source][geo][location][lat]',
1359+
'[source][geo][location][lon]',
1360+
'[source][geo][longitude]',
1361+
'[source][geo][postal_code]',
1362+
'[source][geo][region_code]',
1363+
'[source][geo][region_name]',
1364+
'[source][geo][timezone]',
1365+
'[device]',
1366+
'[name]',
1367+
'[os]',
1368+
'[os_name]',
1369+
'[@shipper][name]',
1370+
'[@source][type]'
1371+
]
13411372
}
13421373

13431374
## set @type
13441375
mutate {
1345-
replace => { "@type" => "alb_access" }
1376+
replace => {
1377+
"@type" => "alb_access"
1378+
"[@source][component]" => "alb_access"
1379+
}
13461380
}
13471381
}
13481382
}

0 commit comments

Comments
 (0)