Skip to content

Commit bee723d

Browse files
committed
Adding template and logstash config
1 parent 3001256 commit bee723d

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

aws-billing-es-template.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"template" : "aws-billing-*",
3+
"settings" : {
4+
"index.refresh_interval" : "10s"
5+
},
6+
"mappings" : {
7+
"_default_" : {
8+
"_all" : {"enabled" : true},
9+
"dynamic_templates" : [ {
10+
"string_fields" : {
11+
"match" : "*",
12+
"match_mapping_type" : "string",
13+
"mapping" : {
14+
"type" : "string", "index" : "analyzed", "omit_norms" : true,
15+
"fields" : {
16+
"raw" : {"type": "string", "index" : "not_analyzed", "ignore_above" : 256}
17+
}
18+
}
19+
}
20+
} ],
21+
"properties" : {
22+
"@version": { "type": "string", "index": "not_analyzed" },
23+
"geoip" : {
24+
"type" : "object",
25+
"dynamic": true,
26+
"path": "full",
27+
"properties" : {
28+
"location" : { "type" : "geo_point" }
29+
}
30+
}
31+
}
32+
}
33+
}
34+
}

logstash.conf

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
input {
2+
tcp {
3+
port => 5140
4+
codec => "line"
5+
}
6+
}
7+
8+
filter {
9+
json {
10+
source => "message"
11+
}
12+
13+
mutate {
14+
add_field => { "index" => "logstash-%{+YYYY.MM.dd}" }
15+
}
16+
17+
if [type] == "aws_billing_hourly" or [type] == "aws_billing_monthly" {
18+
if [type] == "aws_billing_hourly" {
19+
date {
20+
match => [ "UsageStartDate", "ISO8601" ]
21+
}
22+
}
23+
if [type] == "aws_billing_monthly" {
24+
date {
25+
match => [ "BillingPeriodStartDate", "ISO8601" ]
26+
}
27+
}
28+
mutate {
29+
replace => [ "index", "aws-billing-%{+YYYY.MM}"]
30+
remove_field => [ "message" ]
31+
}
32+
}
33+
34+
}
35+
36+
output {
37+
elasticsearch {
38+
embedded => true
39+
index => "%{index}"
40+
}
41+
}

0 commit comments

Comments
 (0)