-
Notifications
You must be signed in to change notification settings - Fork 14
/
gotext.tpl
87 lines (87 loc) · 3.03 KB
/
gotext.tpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{{- $currency := generate "aws.billing.currency" }}
{{- $groupBy := generate "aws.billing.group_definition.key" }}
{{- $period := generate "metricset.period" }}
{{- $cloudId := generate "cloud.account.id" }}
{{- $cloudRegion := generate "cloud.region" }}
{{- $timestamp := generate "timestamp" }}
{
"@timestamp": "{{$timestamp.Format "2006-01-02T15:04:05.999999Z07:00"}}",
"cloud": {
"provider": "aws",
"region": "{{$cloudRegion}}",
"account": {
"id": "{{$cloudId}}",
"name": "{{generate "cloud.account.name"}}"
}
},
"event": {
"dataset": "aws.billing",
"module": "aws",
"duration": {{generate "event.duration"}}
},
"metricset": {
"name": "billing",
"period": {{$period}}
},
"ecs": {
"version": "8.2.0"
},
"aws": {
"billing": {
{{- if eq $groupBy "" }}
"Currency": "{{$currency}}",
"EstimatedCharges": {{generate "aws.billing.EstimatedCharges"}},
"ServiceName": "{{generate "aws.billing.ServiceName"}}"
{{- else }}
{{- $sd := generate "aws.billing.start_date" }}
"start_date": "{{ $sd.Format "2006-01-02T15:04:05.999999Z07:00" }}",
"end_date": "{{ $sd | date_modify (print "+" $period "s") | date "2006-01-02T15:04:05.999999Z07:00" }}",
"AmortizedCost": {
"amount": {{printf "%.2f" (generate "aws.billing.AmortizedCost.amount")}},
"unit": "{{$currency}}"
},
"BlendedCost": {
"amount": {{printf "%.2f" (generate "aws.billing.BlendedCost.amount")}},
"unit": "{{$currency}}"
},
"NormalizedUsageAmount": {
"amount": {{generate "aws.billing.NormalizedUsageAmount.amount"}},
"unit": "N/A"
},
"UnblendedCost": {
"amount": {{printf "%.2f" (generate "aws.billing.UnblendedCost.amount")}},
"unit": "{{$currency}}"
},
"UsageQuantity": {
"amount": {{generate "aws.billing.UsageQuantity.amount"}},
"unit": "N/A"
},
"group_definition": {
"key": "{{$groupBy}}",
"type": "{{generate "aws.billing.group_definition.type"}}"
},
"group_by": {
{{- if eq $groupBy "AZ"}}
"AZ": "{{awsAZFromRegion $cloudRegion}}"
{{- else if eq $groupBy "INSTANCE_TYPE"}}
"INSTANCE_TYPE": "{{generate "aws.billing.group_by.INSTANCE_TYPE"}}"
{{- else if eq $groupBy "SERVICE"}}
"SERVICE": "{{generate "aws.billing.group_by.SERVICE"}}"
{{- else if eq $groupBy "LINKED_ACCOUNT"}}
"LINKED_ACCOUNT": "{{$cloudId}}"
{{- end}}
}
{{- end}}
}
},
"service": {
"type": "aws"
},
"agent": {
"id": "{{generate "agent.id"}}",
"name": "{{generate "agent.name"}}",
"type": "metricbeat",
"version": "8.0.0",
"ephemeral_id": "{{generate "agent.ephemeral_id"}}"
}
}