Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map cloud.account.id to azure sub id #21483

Merged
merged 31 commits into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
938e66c
mofidy doc
narph Jul 23, 2020
4daef08
Merge branch 'master' of github.com:elastic/beats
narph Aug 3, 2020
b613178
Merge branch 'master' of github.com:elastic/beats
narph Aug 4, 2020
05364cf
Merge branch 'master' of github.com:elastic/beats
narph Aug 4, 2020
f147c4d
Merge branch 'master' of github.com:elastic/beats
narph Aug 4, 2020
4574718
Merge branch 'master' of github.com:elastic/beats
narph Aug 17, 2020
1e43077
Merge branch 'master' of github.com:elastic/beats
narph Aug 19, 2020
807cf06
Merge branch 'master' of github.com:elastic/beats
narph Aug 24, 2020
2096668
Merge branch 'master' of github.com:elastic/beats
narph Aug 27, 2020
da8ac1f
Merge branch 'master' of github.com:elastic/beats
narph Aug 27, 2020
c2d8930
Merge branch 'master' of github.com:elastic/beats
narph Aug 27, 2020
7bd9e73
Merge branch 'master' of github.com:elastic/beats
narph Aug 31, 2020
6e89a84
Merge branch 'master' of github.com:elastic/beats
narph Aug 31, 2020
bdf21e9
Merge branch 'master' of github.com:elastic/beats
narph Sep 2, 2020
7833687
Merge branch 'master' of github.com:elastic/beats
narph Sep 3, 2020
bbf6178
Merge branch 'master' of github.com:elastic/beats
narph Sep 4, 2020
4ba8817
Merge branch 'master' of github.com:elastic/beats
narph Sep 7, 2020
0cba5dc
Merge branch 'master' of github.com:elastic/beats
narph Sep 8, 2020
b2625ca
Merge branch 'master' of github.com:elastic/beats
narph Sep 8, 2020
5100e6a
Merge branch 'master' of github.com:elastic/beats
narph Sep 9, 2020
a302d31
Merge branch 'master' of github.com:elastic/beats
narph Sep 14, 2020
631d667
Merge branch 'master' of github.com:elastic/beats
narph Sep 15, 2020
35072a5
Merge branch 'master' of github.com:elastic/beats
narph Sep 17, 2020
4b2f87a
Merge branch 'master' of github.com:elastic/beats
narph Sep 22, 2020
f26b533
Merge branch 'master' of github.com:elastic/beats
narph Sep 28, 2020
c61620d
Merge branch 'master' of github.com:elastic/beats
narph Sep 28, 2020
43f90c4
Merge branch 'master' of github.com:elastic/beats
narph Sep 30, 2020
2d28f07
Merge branch 'master' of github.com:elastic/beats
narph Oct 1, 2020
6e5b67f
tet
narph Oct 2, 2020
d9aa5d6
add cloud
narph Oct 2, 2020
ef03efb
changelog
narph Oct 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Add overview and platform health dashboards to Cloud Foundry module. {pull}21124[21124]
- Release lambda metricset in aws module as GA. {issue}21251[21251] {pull}21255[21255]
- Add dashboard for pubsub metricset in googlecloud module. {pull}21326[21326] {issue}17137[17137]
- Map cloud data filed `cloud.account.id` to azure subscription. {pull}21483[21483] {issue}21381[21381]

*Packetbeat*

Expand Down
3 changes: 3 additions & 0 deletions libbeat/processors/add_cloud_metadata/provider_azure_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ var azureVMMetadataFetcher = provider{
azHeaders := map[string]string{"Metadata": "true"}
azSchema := func(m map[string]interface{}) common.MapStr {
out, _ := s.Schema{
"account": s.Object{
"id": c.Str("subscriptionId"),
},
"instance": s.Object{
"id": c.Str("vmId"),
"name": c.Str("name"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ const azInstanceIdentityDocument = `{
"sku": "14.04.4-LTS",
"version": "14.04.201605091",
"vmId": "04ab04c3-63de-4709-a9f9-9ab8c0411d5e",
"vmSize": "Standard_D3_v2"
"vmSize": "Standard_D3_v2",
"subscriptionId": "5tfb04c3-63de-4709-a9f9-9ab8c0411d5e"
}`

func initAzureTestServer() *httptest.Server {
Expand Down Expand Up @@ -87,6 +88,9 @@ func TestRetrieveAzureMetadata(t *testing.T) {
"machine": common.MapStr{
"type": "Standard_D3_v2",
},
"account": common.MapStr{
"id": "5tfb04c3-63de-4709-a9f9-9ab8c0411d5e",
},
"region": "eastus2",
},
}
Expand Down
5 changes: 4 additions & 1 deletion x-pack/metricbeat/module/azure/add_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func addHostMetadata(event *mb.Event, metricList common.MapStr) {
}
}

func addCloudVMMetadata(event *mb.Event, vm VmResource) {
func addCloudVMMetadata(event *mb.Event, vm VmResource, subscriptionId string) {
if vm.Name != "" {
event.RootFields.Put("cloud.instance.name", vm.Name)
event.RootFields.Put("host.name", vm.Name)
Expand All @@ -47,4 +47,7 @@ func addCloudVMMetadata(event *mb.Event, vm VmResource) {
if vm.Size != "" {
event.RootFields.Put("cloud.machine.type", vm.Size)
}
if subscriptionId != "" {
event.RootFields.Put("cloud.account.id", subscriptionId)
}
}
115 changes: 86 additions & 29 deletions x-pack/metricbeat/module/azure/compute_vm/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,86 @@
"@timestamp": "2017-10-12T08:05:34.853Z",
"azure": {
"compute_vm": {
"disk_read_bytes": {
"total": 0
},
"disk_read_operations_per_sec": {
"avg": 3.3875
"avg": 0
},
"disk_write_bytes": {
"total": 2969709.4
},
"disk_write_operations_per_sec": {
"avg": 0.6705
"avg": 0.7809999999999999
},
"inbound_flows": {
"avg": 28.4
"avg": 10
},
"inbound_flows_maximum_creation_rate": {
"avg": 10.4
"avg": 10.6
},
"network_in": {
"total": 1478232
},
"network_in_total": {
"total": 1569665
},
"network_out": {
"total": 793344
},
"network_out_total": {
"total": 1074624
},
"os_disk_bandwidth_consumed_percentage": {
"avg": 0
},
"os_disk_iops_consumed_percentage": {
"avg": 0
},
"os_disk_queue_depth": {
"avg": 0.00125
"avg": 0.002
},
"os_disk_read_bytes_per_sec": {
"avg": 602589.1825
"avg": 0
},
"os_disk_read_operations_per_sec": {
"avg": 5.28375
"avg": 0
},
"os_disk_write_bytes_per_sec": {
"avg": 14137.59375
"avg": 9899.025
},
"os_disk_write_operations_per_sec": {
"avg": 1.46875
"avg": 1.5619999999999998
},
"os_per_disk_qd": {
"avg": 0.00125
"avg": 0.002
},
"os_per_disk_read_bytes_per_sec": {
"avg": 602589.1825
"avg": 0
},
"os_per_disk_read_operations_per_sec": {
"avg": 5.28375
"avg": 0
},
"os_per_disk_write_bytes_per_sec": {
"avg": 14137.59375
"avg": 9899.025
},
"os_per_disk_write_operations_per_sec": {
"avg": 1.46875
"avg": 1.5619999999999998
},
"outbound_flows": {
"avg": 28.4
"avg": 10
},
"outbound_flows_maximum_creation_rate": {
"avg": 10.4
"avg": 10.6
},
"per_disk_qd": {
"avg": 0.0025
"avg": 0
},
"per_disk_read_bytes_per_sec": {
"avg": 51985.035
"avg": 0
},
"per_disk_read_operations_per_sec": {
"avg": 2.92875
"avg": 0
},
"per_disk_write_bytes_per_sec": {
"avg": 0
Expand All @@ -66,26 +90,41 @@
"avg": 0
},
"percentage_cpu": {
"avg": 9.747
"avg": 1.8719999999999999
},
"vm_cached_bandwidth_consumed_percentage": {
"avg": 0
},
"vm_cached_iops_consumed_percentage": {
"avg": 0
},
"vm_uncached_bandwidth_consumed_percentage": {
"avg": 0
},
"vm_uncached_iops_consumed_percentage": {
"avg": 0
}
},
"namespace": "Microsoft.Compute/virtualMachines",
"resource": {
"group": "obs-infrastructure",
"id": "/subscriptions/70bd6e64-4b1e-4835-8896-db77b8eef364/resourceGroups/obs-infrastructure/providers/Microsoft.Compute/virtualMachines/obslinux",
"name": "obslinux",
"id": "/subscriptions/fd675b6f-b5e5-426e-ac45-d1f876d0ffa6/resourceGroups/obs-infrastructure/providers/Microsoft.Compute/virtualMachines/testaz",
"name": "testaz",
"type": "Microsoft.Compute/virtualMachines"
},
"subscription_id": "70bd6e64-4b1e-4835-8896-db77b8eef364",
"subscription_id": "fd675b6f-b5e5-426e-ac45-d1f876d0ffa6",
"timegrain": "PT5M"
},
"cloud": {
"account": {
"id": "fd675b6f-b5e5-426e-ac45-d1f876d0ffa6"
},
"instance": {
"id": "d5d9444a-1964-4d23-9c62-5463ecb16fe0",
"name": "obslinux"
"id": "490fe4cf-2b33-4ead-a016-7e614c2f48ad",
"name": "testaz"
},
"machine": {
"type": "Basic_A0"
"type": "Standard_A1_v2"
},
"provider": "azure",
"region": "westeurope"
Expand All @@ -97,10 +136,28 @@
},
"host": {
"cpu": {
"pct": 0.09747
"pct": 0.01872
},
"id": "d5d9444a-1964-4d23-9c62-5463ecb16fe0",
"name": "obslinux"
"disk": {
"read": {
"bytes": 0
},
"write": {
"bytes": 2969709.4
}
},
"id": "490fe4cf-2b33-4ead-a016-7e614c2f48ad",
"name": "testaz",
"network": {
"in": {
"bytes": 1569665,
"packets": 1478232
},
"out": {
"bytes": 1074624,
"packets": 793344
}
}
},
"metricset": {
"name": "compute_vm",
Expand Down
33 changes: 19 additions & 14 deletions x-pack/metricbeat/module/azure/compute_vm_scaleset/_meta/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
"@timestamp": "2017-10-12T08:05:34.853Z",
"azure": {
"compute_vm_scaleset": {
"cpu_credits_consumed": {
"avg": 0.006999999999999999
},
"cpu_credits_remaining": {
"avg": 84.72
},
"os_per_disk_qd": {
"avg": 0
},
Expand All @@ -12,43 +18,42 @@
"avg": 0
},
"os_per_disk_write_bytes_per_sec": {
"avg": 1872.1200000000001
"avg": 3846.531
},
"os_per_disk_write_operations_per_sec": {
"avg": 0.296
"avg": 0.5519999999999999
}
},
"namespace": "Microsoft.Compute/virtualMachineScaleSets",
"resource": {
"group": "testgroup",
"id": "/subscriptions/70bd6e23-e3er3-4835-6785-db77b8eef364/resourceGroups/testgroup/providers/Microsoft.Compute/virtualMachineScaleSets/vmscaleset",
"name": "vmscaleset",
"tags": {
"environment": "staging",
"role": "allocator"
},
"group": "obs-infrastructure",
"id": "/subscriptions/fd675b6f-b5e5-426e-ac45-d1f876d0ffa6/resourceGroups/obs-infrastructure/providers/Microsoft.Compute/virtualMachineScaleSets/obslinuxvmss",
"name": "obslinuxvmss",
"type": "Microsoft.Compute/virtualMachineScaleSets"
},
"subscription_id": "70bd6e23-e3er3-4835-6785-db77b8eef364",
"subscription_id": "fd675b6f-b5e5-426e-ac45-d1f876d0ffa6",
"timegrain": "PT5M"
},
"cloud": {
"account": {
"id": "fd675b6f-b5e5-426e-ac45-d1f876d0ffa6"
},
"instance": {
"name": "vmscaleset"
"name": "obslinuxvmss"
},
"machine": {
"type": "Standard_D4s_v3"
"type": "Standard_B1ls"
},
"provider": "azure",
"region": "eastus2"
"region": "westeurope"
},
"event": {
"dataset": "azure.compute_vm_scaleset",
"duration": 115000,
"module": "azure"
},
"host": {
"name": "vmscaleset"
"name": "obslinuxvmss"
},
"metricset": {
"name": "compute_vm_scaleset",
Expand Down
4 changes: 2 additions & 2 deletions x-pack/metricbeat/module/azure/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ func EventsMapping(metrics []Metric, client *Client, report mb.ReporterV2) error
event, metricList = createEvent(timestamp, defaultMetric, resource, groupDimValues)
if client.Config.AddCloudMetadata {
vm = client.GetVMForMetaData(&resource, groupDimValues)
addCloudVMMetadata(&event, vm)
addCloudVMMetadata(&event, vm, resource.Subscription)
}
}
}
} else {
event, metricList = createEvent(timestamp, defaultMetric, resource, groupTimeValues)
if client.Config.AddCloudMetadata {
vm = client.GetVMForMetaData(&resource, groupTimeValues)
addCloudVMMetadata(&event, vm)
addCloudVMMetadata(&event, vm, resource.Subscription)
}
}
if client.Config.DefaultResourceType == "" {
Expand Down