diff --git a/.chloggen/mongodbatlasreceiver-add-provider-resource-attributes.yaml b/.chloggen/mongodbatlasreceiver-add-provider-resource-attributes.yaml new file mode 100755 index 000000000000..6d86d5f2d017 --- /dev/null +++ b/.chloggen/mongodbatlasreceiver-add-provider-resource-attributes.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: receiver/mongodbatlasreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: emit resource attributes "`mongodb_atlas.region.name`" and "`mongodb_atlas.provider.name`" on metric scrape. + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [28833] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [] diff --git a/receiver/mongodbatlasreceiver/access_logs.go b/receiver/mongodbatlasreceiver/access_logs.go index 8d258c0b29be..932b04a7ea6a 100644 --- a/receiver/mongodbatlasreceiver/access_logs.go +++ b/receiver/mongodbatlasreceiver/access_logs.go @@ -305,6 +305,8 @@ func transformAccessLogs(now pcommon.Timestamp, accessLogs []*mongodbatlas.Acces ra := resourceLogs.Resource().Attributes() ra.PutStr("mongodbatlas.project.name", p.Name) ra.PutStr("mongodbatlas.project.id", p.ID) + ra.PutStr("mongodbatlas.region.name", c.ProviderSettings.RegionName) + ra.PutStr("mongodbatlas.provider.name", c.ProviderSettings.ProviderName) ra.PutStr("mongodbatlas.org.id", p.OrgID) ra.PutStr("mongodbatlas.cluster.name", c.Name) diff --git a/receiver/mongodbatlasreceiver/access_logs_integration_test.go b/receiver/mongodbatlasreceiver/access_logs_integration_test.go index 6f9e6a76860d..a8f39163136e 100644 --- a/receiver/mongodbatlasreceiver/access_logs_integration_test.go +++ b/receiver/mongodbatlasreceiver/access_logs_integration_test.go @@ -46,6 +46,10 @@ func TestAccessLogsIntegration(t *testing.T) { { GroupID: testProjectID, Name: testClusterName, + ProviderSettings: &mongodbatlas.ProviderSettings{ + ProviderName: testProviderName, + RegionName: testRegionName, + }, }, }, nil) diff --git a/receiver/mongodbatlasreceiver/access_logs_test.go b/receiver/mongodbatlasreceiver/access_logs_test.go index 08e1669c16be..0a780055f192 100644 --- a/receiver/mongodbatlasreceiver/access_logs_test.go +++ b/receiver/mongodbatlasreceiver/access_logs_test.go @@ -47,6 +47,10 @@ func TestAccessLogToLogRecord(t *testing.T) { cluster := mongodbatlas.Cluster{ GroupID: testProjectID, Name: testClusterName, + ProviderSettings: &mongodbatlas.ProviderSettings{ + ProviderName: testProviderName, + RegionName: testRegionName, + }, } inputLogs := []*mongodbatlas.AccessLogs{ @@ -79,10 +83,12 @@ func TestAccessLogToLogRecord(t *testing.T) { rl := expectedLogs.ResourceLogs().AppendEmpty() assert.NoError(t, rl.Resource().Attributes().FromRaw(map[string]any{ - "mongodbatlas.project.name": testProjectName, - "mongodbatlas.project.id": testProjectID, - "mongodbatlas.org.id": testOrgID, - "mongodbatlas.cluster.name": testClusterName, + "mongodbatlas.project.name": testProjectName, + "mongodbatlas.project.id": testProjectID, + "mongodbatlas.org.id": testOrgID, + "mongodbatlas.cluster.name": testClusterName, + "mongodbatlas.region.name": testRegionName, + "mongodbatlas.provider.name": testProviderName, })) records := rl.ScopeLogs().AppendEmpty().LogRecords() @@ -180,10 +186,12 @@ func TestAccessLogsRetrieval(t *testing.T) { } validateAttributes(t, expectedStringAttributes, l) expectedResourceAttributes := map[string]string{ - "mongodbatlas.cluster.name": testClusterName, - "mongodbatlas.project.name": testProjectName, - "mongodbatlas.project.id": testProjectID, - "mongodbatlas.org.id": testOrgID, + "mongodbatlas.cluster.name": testClusterName, + "mongodbatlas.project.name": testProjectName, + "mongodbatlas.project.id": testProjectID, + "mongodbatlas.org.id": testOrgID, + "mongodbatlas.region.name": testRegionName, + "mongodbatlas.provider.name": testProviderName, } ra := l.ResourceLogs().At(0).Resource().Attributes() @@ -335,6 +343,10 @@ func testClientBase() *mockAccessLogsClient { { GroupID: testProjectID, Name: testClusterName, + ProviderSettings: &mongodbatlas.ProviderSettings{ + ProviderName: testProviderName, + RegionName: testRegionName, + }, }, }, nil) diff --git a/receiver/mongodbatlasreceiver/alerts_test.go b/receiver/mongodbatlasreceiver/alerts_test.go index 6f141b574167..23562edc83e8 100644 --- a/receiver/mongodbatlasreceiver/alerts_test.go +++ b/receiver/mongodbatlasreceiver/alerts_test.go @@ -434,6 +434,8 @@ const ( testTypeName = "OUTSIDE_METRIC_THRESHOLD" testHostNameAndPort = "127.0.0.1:27017" testClusterName = "Cluster1" + testRegionName = "region-name" + testProviderName = "provider-name" ) func TestAlertsRetrieval(t *testing.T) { diff --git a/receiver/mongodbatlasreceiver/documentation.md b/receiver/mongodbatlasreceiver/documentation.md index 0235b4aa79d0..ae5120d4b7a3 100644 --- a/receiver/mongodbatlasreceiver/documentation.md +++ b/receiver/mongodbatlasreceiver/documentation.md @@ -947,4 +947,6 @@ Aggregate of MongoDB Metrics MAX_SWAP_USAGE_FREE, MAX_SWAP_USAGE_USED | mongodb_atlas.process.type_name | Process type | Any Str | true | | mongodb_atlas.project.id | Project ID | Any Str | true | | mongodb_atlas.project.name | Project Name | Any Str | true | +| mongodb_atlas.provider.name | Provider Name | Any Str | false | +| mongodb_atlas.region.name | Region Name | Any Str | false | | mongodb_atlas.user.alias | User-friendly hostname of the cluster node | Any Str | false | diff --git a/receiver/mongodbatlasreceiver/internal/metadata/generated_config.go b/receiver/mongodbatlasreceiver/internal/metadata/generated_config.go index 0fa05e63095c..651e95bf1b96 100644 --- a/receiver/mongodbatlasreceiver/internal/metadata/generated_config.go +++ b/receiver/mongodbatlasreceiver/internal/metadata/generated_config.go @@ -311,6 +311,8 @@ type ResourceAttributesConfig struct { MongodbAtlasProcessTypeName ResourceAttributeConfig `mapstructure:"mongodb_atlas.process.type_name"` MongodbAtlasProjectID ResourceAttributeConfig `mapstructure:"mongodb_atlas.project.id"` MongodbAtlasProjectName ResourceAttributeConfig `mapstructure:"mongodb_atlas.project.name"` + MongodbAtlasProviderName ResourceAttributeConfig `mapstructure:"mongodb_atlas.provider.name"` + MongodbAtlasRegionName ResourceAttributeConfig `mapstructure:"mongodb_atlas.region.name"` MongodbAtlasUserAlias ResourceAttributeConfig `mapstructure:"mongodb_atlas.user.alias"` } @@ -346,6 +348,12 @@ func DefaultResourceAttributesConfig() ResourceAttributesConfig { MongodbAtlasProjectName: ResourceAttributeConfig{ Enabled: true, }, + MongodbAtlasProviderName: ResourceAttributeConfig{ + Enabled: false, + }, + MongodbAtlasRegionName: ResourceAttributeConfig{ + Enabled: false, + }, MongodbAtlasUserAlias: ResourceAttributeConfig{ Enabled: false, }, diff --git a/receiver/mongodbatlasreceiver/internal/metadata/generated_config_test.go b/receiver/mongodbatlasreceiver/internal/metadata/generated_config_test.go index 1bbb93a8f7f8..1159eb879d7d 100644 --- a/receiver/mongodbatlasreceiver/internal/metadata/generated_config_test.go +++ b/receiver/mongodbatlasreceiver/internal/metadata/generated_config_test.go @@ -100,6 +100,8 @@ func TestMetricsBuilderConfig(t *testing.T) { MongodbAtlasProcessTypeName: ResourceAttributeConfig{Enabled: true}, MongodbAtlasProjectID: ResourceAttributeConfig{Enabled: true}, MongodbAtlasProjectName: ResourceAttributeConfig{Enabled: true}, + MongodbAtlasProviderName: ResourceAttributeConfig{Enabled: true}, + MongodbAtlasRegionName: ResourceAttributeConfig{Enabled: true}, MongodbAtlasUserAlias: ResourceAttributeConfig{Enabled: true}, }, }, @@ -182,6 +184,8 @@ func TestMetricsBuilderConfig(t *testing.T) { MongodbAtlasProcessTypeName: ResourceAttributeConfig{Enabled: false}, MongodbAtlasProjectID: ResourceAttributeConfig{Enabled: false}, MongodbAtlasProjectName: ResourceAttributeConfig{Enabled: false}, + MongodbAtlasProviderName: ResourceAttributeConfig{Enabled: false}, + MongodbAtlasRegionName: ResourceAttributeConfig{Enabled: false}, MongodbAtlasUserAlias: ResourceAttributeConfig{Enabled: false}, }, }, @@ -229,6 +233,8 @@ func TestResourceAttributesConfig(t *testing.T) { MongodbAtlasProcessTypeName: ResourceAttributeConfig{Enabled: true}, MongodbAtlasProjectID: ResourceAttributeConfig{Enabled: true}, MongodbAtlasProjectName: ResourceAttributeConfig{Enabled: true}, + MongodbAtlasProviderName: ResourceAttributeConfig{Enabled: true}, + MongodbAtlasRegionName: ResourceAttributeConfig{Enabled: true}, MongodbAtlasUserAlias: ResourceAttributeConfig{Enabled: true}, }, }, @@ -245,6 +251,8 @@ func TestResourceAttributesConfig(t *testing.T) { MongodbAtlasProcessTypeName: ResourceAttributeConfig{Enabled: false}, MongodbAtlasProjectID: ResourceAttributeConfig{Enabled: false}, MongodbAtlasProjectName: ResourceAttributeConfig{Enabled: false}, + MongodbAtlasProviderName: ResourceAttributeConfig{Enabled: false}, + MongodbAtlasRegionName: ResourceAttributeConfig{Enabled: false}, MongodbAtlasUserAlias: ResourceAttributeConfig{Enabled: false}, }, }, diff --git a/receiver/mongodbatlasreceiver/internal/metadata/generated_metrics_test.go b/receiver/mongodbatlasreceiver/internal/metadata/generated_metrics_test.go index 7403ddb15dfc..6554b33fade1 100644 --- a/receiver/mongodbatlasreceiver/internal/metadata/generated_metrics_test.go +++ b/receiver/mongodbatlasreceiver/internal/metadata/generated_metrics_test.go @@ -314,6 +314,8 @@ func TestMetricsBuilder(t *testing.T) { rb.SetMongodbAtlasProcessTypeName("mongodb_atlas.process.type_name-val") rb.SetMongodbAtlasProjectID("mongodb_atlas.project.id-val") rb.SetMongodbAtlasProjectName("mongodb_atlas.project.name-val") + rb.SetMongodbAtlasProviderName("mongodb_atlas.provider.name-val") + rb.SetMongodbAtlasRegionName("mongodb_atlas.region.name-val") rb.SetMongodbAtlasUserAlias("mongodb_atlas.user.alias-val") res := rb.Emit() metrics := mb.Emit(WithResource(res)) diff --git a/receiver/mongodbatlasreceiver/internal/metadata/generated_resource.go b/receiver/mongodbatlasreceiver/internal/metadata/generated_resource.go index 41965211b057..ce74c5ce8321 100644 --- a/receiver/mongodbatlasreceiver/internal/metadata/generated_resource.go +++ b/receiver/mongodbatlasreceiver/internal/metadata/generated_resource.go @@ -91,6 +91,20 @@ func (rb *ResourceBuilder) SetMongodbAtlasProjectName(val string) { } } +// SetMongodbAtlasProviderName sets provided value as "mongodb_atlas.provider.name" attribute. +func (rb *ResourceBuilder) SetMongodbAtlasProviderName(val string) { + if rb.config.MongodbAtlasProviderName.Enabled { + rb.res.Attributes().PutStr("mongodb_atlas.provider.name", val) + } +} + +// SetMongodbAtlasRegionName sets provided value as "mongodb_atlas.region.name" attribute. +func (rb *ResourceBuilder) SetMongodbAtlasRegionName(val string) { + if rb.config.MongodbAtlasRegionName.Enabled { + rb.res.Attributes().PutStr("mongodb_atlas.region.name", val) + } +} + // SetMongodbAtlasUserAlias sets provided value as "mongodb_atlas.user.alias" attribute. func (rb *ResourceBuilder) SetMongodbAtlasUserAlias(val string) { if rb.config.MongodbAtlasUserAlias.Enabled { diff --git a/receiver/mongodbatlasreceiver/internal/metadata/generated_resource_test.go b/receiver/mongodbatlasreceiver/internal/metadata/generated_resource_test.go index 69d43f4ed287..5f75e77055eb 100644 --- a/receiver/mongodbatlasreceiver/internal/metadata/generated_resource_test.go +++ b/receiver/mongodbatlasreceiver/internal/metadata/generated_resource_test.go @@ -23,6 +23,8 @@ func TestResourceBuilder(t *testing.T) { rb.SetMongodbAtlasProcessTypeName("mongodb_atlas.process.type_name-val") rb.SetMongodbAtlasProjectID("mongodb_atlas.project.id-val") rb.SetMongodbAtlasProjectName("mongodb_atlas.project.name-val") + rb.SetMongodbAtlasProviderName("mongodb_atlas.provider.name-val") + rb.SetMongodbAtlasRegionName("mongodb_atlas.region.name-val") rb.SetMongodbAtlasUserAlias("mongodb_atlas.user.alias-val") res := rb.Emit() @@ -32,7 +34,7 @@ func TestResourceBuilder(t *testing.T) { case "default": assert.Equal(t, 9, res.Attributes().Len()) case "all_set": - assert.Equal(t, 11, res.Attributes().Len()) + assert.Equal(t, 13, res.Attributes().Len()) case "none_set": assert.Equal(t, 0, res.Attributes().Len()) return @@ -90,6 +92,16 @@ func TestResourceBuilder(t *testing.T) { if ok { assert.EqualValues(t, "mongodb_atlas.project.name-val", val.Str()) } + val, ok = res.Attributes().Get("mongodb_atlas.provider.name") + assert.Equal(t, test == "all_set", ok) + if ok { + assert.EqualValues(t, "mongodb_atlas.provider.name-val", val.Str()) + } + val, ok = res.Attributes().Get("mongodb_atlas.region.name") + assert.Equal(t, test == "all_set", ok) + if ok { + assert.EqualValues(t, "mongodb_atlas.region.name-val", val.Str()) + } val, ok = res.Attributes().Get("mongodb_atlas.user.alias") assert.Equal(t, test == "all_set", ok) if ok { diff --git a/receiver/mongodbatlasreceiver/internal/metadata/testdata/config.yaml b/receiver/mongodbatlasreceiver/internal/metadata/testdata/config.yaml index cabc77d12f89..97fb52af00ad 100644 --- a/receiver/mongodbatlasreceiver/internal/metadata/testdata/config.yaml +++ b/receiver/mongodbatlasreceiver/internal/metadata/testdata/config.yaml @@ -146,6 +146,10 @@ all_set: enabled: true mongodb_atlas.project.name: enabled: true + mongodb_atlas.provider.name: + enabled: true + mongodb_atlas.region.name: + enabled: true mongodb_atlas.user.alias: enabled: true none_set: @@ -295,5 +299,9 @@ none_set: enabled: false mongodb_atlas.project.name: enabled: false + mongodb_atlas.provider.name: + enabled: false + mongodb_atlas.region.name: + enabled: false mongodb_atlas.user.alias: enabled: false diff --git a/receiver/mongodbatlasreceiver/logs.go b/receiver/mongodbatlasreceiver/logs.go index 1a69e5e4a8d3..1f5b41bf03d9 100644 --- a/receiver/mongodbatlasreceiver/logs.go +++ b/receiver/mongodbatlasreceiver/logs.go @@ -148,20 +148,34 @@ func (s *logsReceiver) processClusters(ctx context.Context, projectCfg LogsProje return filterClusters(clusters, projectCfg.ProjectConfig) } +type ClusterInfo struct { + ClusterName string + RegionName string + ProviderName string + MongoDBMajorVersion string +} + func (s *logsReceiver) collectClusterLogs(clusters []mongodbatlas.Cluster, projectCfg LogsProjectConfig, pc ProjectContext) { for _, cluster := range clusters { + clusterInfo := ClusterInfo{ + ClusterName: cluster.Name, + RegionName: cluster.ProviderSettings.RegionName, + ProviderName: cluster.ProviderSettings.ProviderName, + MongoDBMajorVersion: cluster.MongoDBMajorVersion, + } + hostnames := parseHostNames(cluster.ConnectionStrings.Standard, s.log) for _, hostname := range hostnames { // Defaults to true if not specified if projectCfg.EnableHostLogs == nil || *projectCfg.EnableHostLogs { - s.collectLogs(pc, hostname, "mongodb.gz", cluster.Name, cluster.MongoDBMajorVersion) - s.collectLogs(pc, hostname, "mongos.gz", cluster.Name, cluster.MongoDBMajorVersion) + s.collectLogs(pc, hostname, "mongodb.gz", clusterInfo) + s.collectLogs(pc, hostname, "mongos.gz", clusterInfo) } // Defaults to false if not specified if projectCfg.EnableAuditLogs { - s.collectAuditLogs(pc, hostname, "mongodb-audit-log.gz", cluster.Name, cluster.MongoDBMajorVersion) - s.collectAuditLogs(pc, hostname, "mongos-audit-log.gz", cluster.Name, cluster.MongoDBMajorVersion) + s.collectAuditLogs(pc, hostname, "mongodb-audit-log.gz", clusterInfo) + s.collectAuditLogs(pc, hostname, "mongos-audit-log.gz", clusterInfo) } } } @@ -218,8 +232,8 @@ func (s *logsReceiver) getHostAuditLogs(groupID, hostname, logName string) ([]mo return decodeAuditJSON(s.log, buf) } -func (s *logsReceiver) collectLogs(pc ProjectContext, hostname, logName, clusterName, clusterMajorVersion string) { - logs, err := s.getHostLogs(pc.Project.ID, hostname, logName, clusterMajorVersion) +func (s *logsReceiver) collectLogs(pc ProjectContext, hostname, logName string, clusterInfo ClusterInfo) { + logs, err := s.getHostLogs(pc.Project.ID, hostname, logName, clusterInfo.MongoDBMajorVersion) if err != nil && !errors.Is(err, io.EOF) { s.log.Warn("Failed to retrieve host logs", zap.Error(err), zap.String("log", logName)) return @@ -235,15 +249,14 @@ func (s *logsReceiver) collectLogs(pc ProjectContext, hostname, logName, cluster pc, hostname, logName, - clusterName, - clusterMajorVersion) + clusterInfo) err = s.consumer.ConsumeLogs(context.Background(), plog) if err != nil { s.log.Error("Failed to consume logs", zap.Error(err)) } } -func (s *logsReceiver) collectAuditLogs(pc ProjectContext, hostname, logName, clusterName, clusterMajorVersion string) { +func (s *logsReceiver) collectAuditLogs(pc ProjectContext, hostname, logName string, clusterInfo ClusterInfo) { logs, err := s.getHostAuditLogs( pc.Project.ID, hostname, @@ -265,8 +278,7 @@ func (s *logsReceiver) collectAuditLogs(pc ProjectContext, hostname, logName, cl pc, hostname, logName, - clusterName, - clusterMajorVersion) + clusterInfo) if err != nil { s.log.Warn("Failed to translate audit logs: "+logName, zap.Error(err)) return diff --git a/receiver/mongodbatlasreceiver/metadata.yaml b/receiver/mongodbatlasreceiver/metadata.yaml index 79acdc203592..70c480db697d 100644 --- a/receiver/mongodbatlasreceiver/metadata.yaml +++ b/receiver/mongodbatlasreceiver/metadata.yaml @@ -33,6 +33,14 @@ resource_attributes: description: Cluster Name enabled: false type: string + mongodb_atlas.region.name: + description: Region Name + enabled: false + type: string + mongodb_atlas.provider.name: + description: Provider Name + enabled: false + type: string mongodb_atlas.process.port: description: Port process is bound to enabled: true diff --git a/receiver/mongodbatlasreceiver/mongodb_event_to_logdata.go b/receiver/mongodbatlasreceiver/mongodb_event_to_logdata.go index c1c8e9df2275..2ac6a81c68fa 100644 --- a/receiver/mongodbatlasreceiver/mongodb_event_to_logdata.go +++ b/receiver/mongodbatlasreceiver/mongodb_event_to_logdata.go @@ -43,7 +43,7 @@ var severityMap = map[string]plog.SeverityNumber{ } // mongoAuditEventToLogRecord converts model.AuditLog event to plog.LogRecordSlice and adds the resource attributes. -func mongodbAuditEventToLogData(logger *zap.Logger, logs []model.AuditLog, pc ProjectContext, hostname, logName, clusterName, clusterMajorVersion string) (plog.Logs, error) { +func mongodbAuditEventToLogData(logger *zap.Logger, logs []model.AuditLog, pc ProjectContext, hostname, logName string, clusterInfo ClusterInfo) (plog.Logs, error) { ld := plog.NewLogs() rl := ld.ResourceLogs().AppendEmpty() sl := rl.ScopeLogs().AppendEmpty() @@ -54,7 +54,9 @@ func mongodbAuditEventToLogData(logger *zap.Logger, logs []model.AuditLog, pc Pr // Attributes related to the object causing the event. resourceAttrs.PutStr("mongodb_atlas.org", pc.orgName) resourceAttrs.PutStr("mongodb_atlas.project", pc.Project.Name) - resourceAttrs.PutStr("mongodb_atlas.cluster", clusterName) + resourceAttrs.PutStr("mongodb_atlas.cluster", clusterInfo.ClusterName) + resourceAttrs.PutStr("mongodb_atlas.region.name", clusterInfo.RegionName) + resourceAttrs.PutStr("mongodb_atlas.provider.name", clusterInfo.ProviderName) resourceAttrs.PutStr("mongodb_atlas.host.name", hostname) var errs []error @@ -62,7 +64,7 @@ func mongodbAuditEventToLogData(logger *zap.Logger, logs []model.AuditLog, pc Pr for _, log := range logs { lr := sl.LogRecords().AppendEmpty() - logTsFormat := tsLayout(clusterMajorVersion) + logTsFormat := tsLayout(clusterInfo.MongoDBMajorVersion) t, err := time.Parse(logTsFormat, log.Timestamp.Date) if err != nil { logger.Warn("Time failed to parse correctly", zap.Error(err)) @@ -143,7 +145,7 @@ func mongodbAuditEventToLogData(logger *zap.Logger, logs []model.AuditLog, pc Pr } // mongoEventToLogRecord converts model.LogEntry event to plog.LogRecordSlice and adds the resource attributes. -func mongodbEventToLogData(logger *zap.Logger, logs []model.LogEntry, pc ProjectContext, hostname, logName, clusterName, clusterMajorVersion string) plog.Logs { +func mongodbEventToLogData(logger *zap.Logger, logs []model.LogEntry, pc ProjectContext, hostname, logName string, clusterInfo ClusterInfo) plog.Logs { ld := plog.NewLogs() rl := ld.ResourceLogs().AppendEmpty() sl := rl.ScopeLogs().AppendEmpty() @@ -154,10 +156,12 @@ func mongodbEventToLogData(logger *zap.Logger, logs []model.LogEntry, pc Project // Attributes related to the object causing the event. resourceAttrs.PutStr("mongodb_atlas.org", pc.orgName) resourceAttrs.PutStr("mongodb_atlas.project", pc.Project.Name) - resourceAttrs.PutStr("mongodb_atlas.cluster", clusterName) + resourceAttrs.PutStr("mongodb_atlas.cluster", clusterInfo.ClusterName) + resourceAttrs.PutStr("mongodb_atlas.region.name", clusterInfo.RegionName) + resourceAttrs.PutStr("mongodb_atlas.provider.name", clusterInfo.ProviderName) resourceAttrs.PutStr("mongodb_atlas.host.name", hostname) - logTsFormat := tsLayout(clusterMajorVersion) + logTsFormat := tsLayout(clusterInfo.MongoDBMajorVersion) for _, log := range logs { lr := sl.LogRecords().AppendEmpty() @@ -187,7 +191,7 @@ func mongodbEventToLogData(logger *zap.Logger, logs []model.LogEntry, pc Project attrs.PutStr("component", log.Component) attrs.PutStr("context", log.Context) // log ID is not present on MongoDB 4.2 systems - if clusterMajorVersion != mongoDBMajorVersion4_2 { + if clusterInfo.MongoDBMajorVersion != mongoDBMajorVersion4_2 { attrs.PutInt("id", log.ID) } attrs.PutStr("log_name", logName) diff --git a/receiver/mongodbatlasreceiver/mongodb_event_to_logdata_test.go b/receiver/mongodbatlasreceiver/mongodb_event_to_logdata_test.go index 267b652558fe..99a426122417 100644 --- a/receiver/mongodbatlasreceiver/mongodb_event_to_logdata_test.go +++ b/receiver/mongodbatlasreceiver/mongodb_event_to_logdata_test.go @@ -23,8 +23,14 @@ func TestMongoeventToLogData4_4(t *testing.T) { orgName: "Org", Project: mongodbatlas.Project{Name: "Project"}, } + clusterInfo := ClusterInfo{ + ClusterName: "clusterName", + RegionName: "regionName", + ProviderName: "providerName", + MongoDBMajorVersion: "4.4", + } - ld := mongodbEventToLogData(zap.NewNop(), []model.LogEntry{mongoevent}, pc, "hostname", "logName", "clusterName", "4.4") + ld := mongodbEventToLogData(zap.NewNop(), []model.LogEntry{mongoevent}, pc, "hostname", "logName", clusterInfo) rl := ld.ResourceLogs().At(0) resourceAttrs := rl.Resource().Attributes() sl := rl.ScopeLogs().At(0) @@ -32,11 +38,13 @@ func TestMongoeventToLogData4_4(t *testing.T) { attrs := lr.Attributes() assert.Equal(t, 1, ld.ResourceLogs().Len()) - assert.Equal(t, 4, resourceAttrs.Len()) + assert.Equal(t, 6, resourceAttrs.Len()) assertString(t, resourceAttrs, "mongodb_atlas.org", "Org") assertString(t, resourceAttrs, "mongodb_atlas.project", "Project") assertString(t, resourceAttrs, "mongodb_atlas.cluster", "clusterName") assertString(t, resourceAttrs, "mongodb_atlas.host.name", "hostname") + assertString(t, resourceAttrs, "mongodb_atlas.region.name", "regionName") + assertString(t, resourceAttrs, "mongodb_atlas.provider.name", "providerName") t.Logf("%+v", attrs.AsRaw()) assert.Equal(t, 8, attrs.Len()) @@ -62,7 +70,14 @@ func TestMongoeventToLogData4_2(t *testing.T) { Project: mongodbatlas.Project{Name: "Project"}, } - ld := mongodbEventToLogData(zaptest.NewLogger(t), []model.LogEntry{mongoevent}, pc, "hostname", "logName", "clusterName", "4.2") + clusterInfo := ClusterInfo{ + ClusterName: "clusterName", + RegionName: "regionName", + ProviderName: "providerName", + MongoDBMajorVersion: "4.2", + } + + ld := mongodbEventToLogData(zaptest.NewLogger(t), []model.LogEntry{mongoevent}, pc, "hostname", "logName", clusterInfo) rl := ld.ResourceLogs().At(0) resourceAttrs := rl.Resource().Attributes() sl := rl.ScopeLogs().At(0) @@ -70,10 +85,12 @@ func TestMongoeventToLogData4_2(t *testing.T) { attrs := lr.Attributes() assert.Equal(t, 1, ld.ResourceLogs().Len()) - assert.Equal(t, 4, resourceAttrs.Len()) + assert.Equal(t, 6, resourceAttrs.Len()) assertString(t, resourceAttrs, "mongodb_atlas.org", "Org") assertString(t, resourceAttrs, "mongodb_atlas.project", "Project") assertString(t, resourceAttrs, "mongodb_atlas.cluster", "clusterName") + assertString(t, resourceAttrs, "mongodb_atlas.region.name", "regionName") + assertString(t, resourceAttrs, "mongodb_atlas.provider.name", "providerName") assertString(t, resourceAttrs, "mongodb_atlas.host.name", "hostname") assert.Equal(t, 4, attrs.Len()) @@ -98,8 +115,14 @@ func TestUnknownSeverity(t *testing.T) { orgName: "Org", Project: mongodbatlas.Project{Name: "Project"}, } + clusterInfo := ClusterInfo{ + ClusterName: "clusterName", + RegionName: "regionName", + ProviderName: "providerName", + MongoDBMajorVersion: "4.4", + } - ld := mongodbEventToLogData(zap.NewNop(), []model.LogEntry{mongoevent}, pc, "hostname", "clusterName", "logName", "4.4") + ld := mongodbEventToLogData(zap.NewNop(), []model.LogEntry{mongoevent}, pc, "hostname", "clusterName", clusterInfo) rl := ld.ResourceLogs().At(0) logEntry := rl.ScopeLogs().At(0).LogRecords().At(0) @@ -114,7 +137,14 @@ func TestMongoEventToAuditLogData5_0(t *testing.T) { Project: mongodbatlas.Project{Name: "Project"}, } - ld, err := mongodbAuditEventToLogData(zaptest.NewLogger(t), []model.AuditLog{mongoevent}, pc, "hostname", "logName", "clusterName", "5.0") + clusterInfo := ClusterInfo{ + ClusterName: "clusterName", + RegionName: "regionName", + ProviderName: "providerName", + MongoDBMajorVersion: "5.0", + } + + ld, err := mongodbAuditEventToLogData(zaptest.NewLogger(t), []model.AuditLog{mongoevent}, pc, "hostname", "logName", clusterInfo) require.NoError(t, err) rl := ld.ResourceLogs().At(0) resourceAttrs := rl.Resource().Attributes() @@ -123,11 +153,13 @@ func TestMongoEventToAuditLogData5_0(t *testing.T) { attrs := lr.Attributes() assert.Equal(t, ld.ResourceLogs().Len(), 1) - assert.Equal(t, resourceAttrs.Len(), 4) + assert.Equal(t, resourceAttrs.Len(), 6) assertString(t, resourceAttrs, "mongodb_atlas.org", "Org") assertString(t, resourceAttrs, "mongodb_atlas.project", "Project") assertString(t, resourceAttrs, "mongodb_atlas.cluster", "clusterName") assertString(t, resourceAttrs, "mongodb_atlas.host.name", "hostname") + assertString(t, resourceAttrs, "mongodb_atlas.region.name", "regionName") + assertString(t, resourceAttrs, "mongodb_atlas.provider.name", "providerName") assert.Equal(t, 14, attrs.Len()) assertString(t, attrs, "atype", "authenticate") @@ -171,7 +203,14 @@ func TestMongoEventToAuditLogData4_2(t *testing.T) { Project: mongodbatlas.Project{Name: "Project"}, } - ld, err := mongodbAuditEventToLogData(zaptest.NewLogger(t), []model.AuditLog{mongoevent}, pc, "hostname", "logName", "clusterName", "4.2") + clusterInfo := ClusterInfo{ + ClusterName: "clusterName", + RegionName: "regionName", + ProviderName: "providerName", + MongoDBMajorVersion: "4.2", + } + + ld, err := mongodbAuditEventToLogData(zaptest.NewLogger(t), []model.AuditLog{mongoevent}, pc, "hostname", "logName", clusterInfo) require.NoError(t, err) rl := ld.ResourceLogs().At(0) resourceAttrs := rl.Resource().Attributes() @@ -180,11 +219,13 @@ func TestMongoEventToAuditLogData4_2(t *testing.T) { attrs := lr.Attributes() assert.Equal(t, ld.ResourceLogs().Len(), 1) - assert.Equal(t, resourceAttrs.Len(), 4) + assert.Equal(t, resourceAttrs.Len(), 6) assertString(t, resourceAttrs, "mongodb_atlas.org", "Org") assertString(t, resourceAttrs, "mongodb_atlas.project", "Project") assertString(t, resourceAttrs, "mongodb_atlas.cluster", "clusterName") assertString(t, resourceAttrs, "mongodb_atlas.host.name", "hostname") + assertString(t, resourceAttrs, "mongodb_atlas.region.name", "regionName") + assertString(t, resourceAttrs, "mongodb_atlas.provider.name", "providerName") assert.Equal(t, 10, attrs.Len()) assertString(t, attrs, "atype", "authenticate") diff --git a/receiver/mongodbatlasreceiver/receiver.go b/receiver/mongodbatlasreceiver/receiver.go index 3f85a6443555..72723aa552b0 100644 --- a/receiver/mongodbatlasreceiver/receiver.go +++ b/receiver/mongodbatlasreceiver/receiver.go @@ -88,7 +88,7 @@ func (s *mongodbatlasreceiver) poll(ctx context.Context, time timeconstraints) e return fmt.Errorf("error retrieving projects: %w", err) } for _, project := range projects { - nodeClusterMap, err := s.getNodeClusterNameMap(ctx, project.ID) + nodeClusterMap, providerMap, err := s.getNodeClusterNameMap(ctx, project.ID) if err != nil { return fmt.Errorf("error collecting clusters from project %s: %w", project.ID, err) } @@ -99,16 +99,17 @@ func (s *mongodbatlasreceiver) poll(ctx context.Context, time timeconstraints) e } for _, process := range processes { clusterName := nodeClusterMap[process.UserAlias] + providerValues := providerMap[clusterName] - if err := s.extractProcessMetrics(ctx, time, org.Name, project, process, clusterName); err != nil { + if err := s.extractProcessMetrics(ctx, time, org.Name, project, process, clusterName, providerValues); err != nil { return fmt.Errorf("error when polling process metrics from MongoDB Atlas for process %s: %w", process.ID, err) } - if err := s.extractProcessDatabaseMetrics(ctx, time, org.Name, project, process, clusterName); err != nil { + if err := s.extractProcessDatabaseMetrics(ctx, time, org.Name, project, process, clusterName, providerValues); err != nil { return fmt.Errorf("error when polling process database metrics from MongoDB Atlas for process %s: %w", process.ID, err) } - if err := s.extractProcessDiskMetrics(ctx, time, org.Name, project, process, clusterName); err != nil { + if err := s.extractProcessDiskMetrics(ctx, time, org.Name, project, process, clusterName, providerValues); err != nil { return fmt.Errorf("error when polling process disk metrics from MongoDB Atlas for process %s: %w", process.ID, err) } } @@ -117,14 +118,20 @@ func (s *mongodbatlasreceiver) poll(ctx context.Context, time timeconstraints) e return nil } +type providerValues struct { + RegionName string + ProviderName string +} + func (s *mongodbatlasreceiver) getNodeClusterNameMap( ctx context.Context, projectID string, -) (map[string]string, error) { +) (map[string]string, map[string]providerValues, error) { + providerMap := make(map[string]providerValues) clusterMap := make(map[string]string) clusters, err := s.client.GetClusters(ctx, projectID) if err != nil { - return nil, err + return nil, nil, err } for _, cluster := range clusters { @@ -134,10 +141,16 @@ func (s *mongodbatlasreceiver) getNodeClusterNameMap( // Remove the port from the node n, _, _ := strings.Cut(node, ":") clusterMap[n] = cluster.Name + + } + + providerMap[cluster.Name] = providerValues{ + RegionName: cluster.ProviderSettings.RegionName, + ProviderName: cluster.ProviderSettings.ProviderName, } } - return clusterMap, nil + return clusterMap, providerMap, nil } func (s *mongodbatlasreceiver) extractProcessMetrics( @@ -147,6 +160,7 @@ func (s *mongodbatlasreceiver) extractProcessMetrics( project *mongodbatlas.Project, process *mongodbatlas.Process, clusterName string, + providerValues providerValues, ) error { if err := s.client.ProcessMetrics( ctx, @@ -171,6 +185,8 @@ func (s *mongodbatlasreceiver) extractProcessMetrics( rb.SetMongodbAtlasProcessPort(strconv.Itoa(process.Port)) rb.SetMongodbAtlasProcessTypeName(process.TypeName) rb.SetMongodbAtlasProcessID(process.ID) + rb.SetMongodbAtlasRegionName(providerValues.RegionName) + rb.SetMongodbAtlasProviderName(providerValues.ProviderName) s.mb.EmitForResource(metadata.WithResource(rb.Emit())) return nil @@ -183,6 +199,7 @@ func (s *mongodbatlasreceiver) extractProcessDatabaseMetrics( project *mongodbatlas.Project, process *mongodbatlas.Process, clusterName string, + providerValues providerValues, ) error { processDatabases, err := s.client.ProcessDatabases( ctx, @@ -219,6 +236,8 @@ func (s *mongodbatlasreceiver) extractProcessDatabaseMetrics( rb.SetMongodbAtlasProcessTypeName(process.TypeName) rb.SetMongodbAtlasProcessID(process.ID) rb.SetMongodbAtlasDbName(db.DatabaseName) + rb.SetMongodbAtlasRegionName(providerValues.RegionName) + rb.SetMongodbAtlasProviderName(providerValues.ProviderName) s.mb.EmitForResource(metadata.WithResource(rb.Emit())) } return nil @@ -231,6 +250,7 @@ func (s *mongodbatlasreceiver) extractProcessDiskMetrics( project *mongodbatlas.Project, process *mongodbatlas.Process, clusterName string, + providerValues providerValues, ) error { for _, disk := range s.client.ProcessDisks(ctx, project.ID, process.Hostname, process.Port) { if err := s.client.ProcessDiskMetrics( @@ -257,6 +277,8 @@ func (s *mongodbatlasreceiver) extractProcessDiskMetrics( rb.SetMongodbAtlasProcessTypeName(process.TypeName) rb.SetMongodbAtlasProcessID(process.ID) rb.SetMongodbAtlasDiskPartition(disk.PartitionName) + rb.SetMongodbAtlasRegionName(providerValues.RegionName) + rb.SetMongodbAtlasProviderName(providerValues.ProviderName) s.mb.EmitForResource(metadata.WithResource(rb.Emit())) } return nil diff --git a/receiver/mongodbatlasreceiver/testdata/accesslogs/golden/retrieved-logs.yaml b/receiver/mongodbatlasreceiver/testdata/accesslogs/golden/retrieved-logs.yaml index dbb13f10f915..c88b0ceaed60 100644 --- a/receiver/mongodbatlasreceiver/testdata/accesslogs/golden/retrieved-logs.yaml +++ b/receiver/mongodbatlasreceiver/testdata/accesslogs/golden/retrieved-logs.yaml @@ -7,6 +7,12 @@ resourceLogs: - key: mongodbatlas.project.id value: stringValue: test-project-id + - key: mongodbatlas.region.name + value: + stringValue: region-name + - key: mongodbatlas.provider.name + value: + stringValue: provider-name - key: mongodbatlas.org.id value: stringValue: test-org-id @@ -40,12 +46,6 @@ resourceLogs: body: kvlistValue: values: - - key: s - value: - stringValue: I - - key: c - value: - stringValue: ACCESS - key: id value: doubleValue: 20249 @@ -59,6 +59,9 @@ resourceLogs: value: kvlistValue: values: + - key: error + value: + stringValue: 'UserNotFound: User "mms-automation@admin" not found' - key: mechanism value: stringValue: SCRAM-SHA-1 @@ -77,9 +80,6 @@ resourceLogs: - key: extraInfo value: kvlistValue: {} - - key: error - value: - stringValue: 'UserNotFound: User "mms-automation@admin" not found' - key: t value: kvlistValue: @@ -87,7 +87,13 @@ resourceLogs: - key: $date value: stringValue: "2023-04-26T02:38:56.454+00:00" - observedTimeUnixNano: "1682740133575250000" + - key: s + value: + stringValue: I + - key: c + value: + stringValue: ACCESS + observedTimeUnixNano: "1698948019769963000" severityNumber: 13 severityText: Warn spanId: "" @@ -118,6 +124,9 @@ resourceLogs: body: kvlistValue: values: + - key: s + value: + stringValue: I - key: c value: stringValue: ACCESS @@ -134,6 +143,15 @@ resourceLogs: value: kvlistValue: values: + - key: remote + value: + stringValue: 555.555.555.555:41052 + - key: extraInfo + value: + kvlistValue: {} + - key: error + value: + stringValue: 'UserNotFound: User "mms-automation@admin" not found' - key: mechanism value: stringValue: SCRAM-SHA-1 @@ -146,15 +164,6 @@ resourceLogs: - key: authenticationDatabase value: stringValue: admin - - key: remote - value: - stringValue: 555.555.555.555:41052 - - key: extraInfo - value: - kvlistValue: {} - - key: error - value: - stringValue: 'UserNotFound: User "mms-automation@admin" not found' - key: t value: kvlistValue: @@ -162,10 +171,7 @@ resourceLogs: - key: $date value: stringValue: "2023-04-26T02:38:56.446+00:00" - - key: s - value: - stringValue: I - observedTimeUnixNano: "1682740133575250000" + observedTimeUnixNano: "1698948019769963000" severityNumber: 13 severityText: Warn spanId: "" @@ -212,6 +218,9 @@ resourceLogs: value: kvlistValue: values: + - key: principalName + value: + stringValue: mms-automation - key: authenticationDatabase value: stringValue: admin @@ -230,9 +239,6 @@ resourceLogs: - key: speculative value: boolValue: true - - key: principalName - value: - stringValue: mms-automation - key: t value: kvlistValue: @@ -243,7 +249,7 @@ resourceLogs: - key: s value: stringValue: I - observedTimeUnixNano: "1682740133575250000" + observedTimeUnixNano: "1698948019769963000" severityNumber: 13 severityText: Warn spanId: "" @@ -278,6 +284,15 @@ resourceLogs: value: kvlistValue: values: + - key: remote + value: + stringValue: 555.555.555.555:48502 + - key: extraInfo + value: + kvlistValue: {} + - key: error + value: + stringValue: 'UserNotFound: User "mms-automation@admin" not found' - key: mechanism value: stringValue: SCRAM-SHA-1 @@ -290,15 +305,6 @@ resourceLogs: - key: authenticationDatabase value: stringValue: admin - - key: remote - value: - stringValue: 555.555.555.555:48502 - - key: extraInfo - value: - kvlistValue: {} - - key: error - value: - stringValue: 'UserNotFound: User "mms-automation@admin" not found' - key: t value: kvlistValue: @@ -321,7 +327,7 @@ resourceLogs: - key: msg value: stringValue: Authentication failed - observedTimeUnixNano: "1682740133575250000" + observedTimeUnixNano: "1698948019769963000" severityNumber: 13 severityText: Warn spanId: "" @@ -352,25 +358,6 @@ resourceLogs: body: kvlistValue: values: - - key: t - value: - kvlistValue: - values: - - key: $date - value: - stringValue: "2023-04-26T02:38:56.356+00:00" - - key: s - value: - stringValue: I - - key: c - value: - stringValue: ACCESS - - key: id - value: - doubleValue: 20249 - - key: ctx - value: - stringValue: conn352 - key: msg value: stringValue: Authentication failed @@ -378,6 +365,9 @@ resourceLogs: value: kvlistValue: values: + - key: extraInfo + value: + kvlistValue: {} - key: error value: stringValue: 'UserNotFound: User "mms-automation@admin" not found' @@ -396,10 +386,26 @@ resourceLogs: - key: remote value: stringValue: 555.555.555.555:48502 - - key: extraInfo + - key: t + value: + kvlistValue: + values: + - key: $date value: - kvlistValue: {} - observedTimeUnixNano: "1682740133575250000" + stringValue: "2023-04-26T02:38:56.356+00:00" + - key: s + value: + stringValue: I + - key: c + value: + stringValue: ACCESS + - key: id + value: + doubleValue: 20249 + - key: ctx + value: + stringValue: conn352 + observedTimeUnixNano: "1698948019769963000" severityNumber: 13 severityText: Warn spanId: "" @@ -430,13 +436,6 @@ resourceLogs: body: kvlistValue: values: - - key: t - value: - kvlistValue: - values: - - key: $date - value: - stringValue: "2023-04-26T02:38:56.352+00:00" - key: s value: stringValue: I @@ -456,9 +455,6 @@ resourceLogs: value: kvlistValue: values: - - key: error - value: - stringValue: 'UserNotFound: User "mms-automation@admin" not found' - key: mechanism value: stringValue: SCRAM-SHA-1 @@ -477,7 +473,17 @@ resourceLogs: - key: extraInfo value: kvlistValue: {} - observedTimeUnixNano: "1682740133575250000" + - key: error + value: + stringValue: 'UserNotFound: User "mms-automation@admin" not found' + - key: t + value: + kvlistValue: + values: + - key: $date + value: + stringValue: "2023-04-26T02:38:56.352+00:00" + observedTimeUnixNano: "1698948019769963000" severityNumber: 13 severityText: Warn spanId: "" @@ -508,6 +514,18 @@ resourceLogs: body: kvlistValue: values: + - key: s + value: + stringValue: I + - key: c + value: + stringValue: ACCESS + - key: id + value: + doubleValue: 20249 + - key: ctx + value: + stringValue: conn349 - key: msg value: stringValue: Authentication failed @@ -515,6 +533,15 @@ resourceLogs: value: kvlistValue: values: + - key: authenticationDatabase + value: + stringValue: admin + - key: remote + value: + stringValue: 555.555.555.555:36896 + - key: extraInfo + value: + kvlistValue: {} - key: error value: stringValue: 'UserNotFound: User "mms-automation@admin" not found' @@ -527,15 +554,6 @@ resourceLogs: - key: principalName value: stringValue: mms-automation - - key: authenticationDatabase - value: - stringValue: admin - - key: remote - value: - stringValue: 555.555.555.555:36896 - - key: extraInfo - value: - kvlistValue: {} - key: t value: kvlistValue: @@ -543,19 +561,7 @@ resourceLogs: - key: $date value: stringValue: "2023-04-26T02:38:56.344+00:00" - - key: s - value: - stringValue: I - - key: c - value: - stringValue: ACCESS - - key: id - value: - doubleValue: 20249 - - key: ctx - value: - stringValue: conn349 - observedTimeUnixNano: "1682740133575250000" + observedTimeUnixNano: "1698948019769963000" severityNumber: 13 severityText: Warn spanId: "" @@ -599,12 +605,6 @@ resourceLogs: value: kvlistValue: values: - - key: speculative - value: - boolValue: false - - key: principalName - value: - stringValue: mms-automation - key: authenticationDatabase value: stringValue: admin @@ -620,6 +620,12 @@ resourceLogs: - key: mechanism value: stringValue: SCRAM-SHA-1 + - key: speculative + value: + boolValue: false + - key: principalName + value: + stringValue: mms-automation - key: t value: kvlistValue: @@ -633,7 +639,7 @@ resourceLogs: - key: c value: stringValue: ACCESS - observedTimeUnixNano: "1682740133575250000" + observedTimeUnixNano: "1698948019769963000" severityNumber: 13 severityText: Warn spanId: "" @@ -664,12 +670,6 @@ resourceLogs: body: kvlistValue: values: - - key: c - value: - stringValue: ACCESS - - key: id - value: - doubleValue: 20249 - key: ctx value: stringValue: conn130 @@ -711,7 +711,13 @@ resourceLogs: - key: s value: stringValue: I - observedTimeUnixNano: "1682740133575250000" + - key: c + value: + stringValue: ACCESS + - key: id + value: + doubleValue: 20249 + observedTimeUnixNano: "1698948019769963000" severityNumber: 13 severityText: Warn spanId: "" @@ -761,6 +767,15 @@ resourceLogs: value: kvlistValue: values: + - key: extraInfo + value: + kvlistValue: {} + - key: error + value: + stringValue: 'UserNotFound: User "mms-automation@admin" not found' + - key: mechanism + value: + stringValue: SCRAM-SHA-1 - key: speculative value: boolValue: false @@ -773,15 +788,6 @@ resourceLogs: - key: remote value: stringValue: 555.555.555.555:34198 - - key: extraInfo - value: - kvlistValue: {} - - key: error - value: - stringValue: 'UserNotFound: User "mms-automation@admin" not found' - - key: mechanism - value: - stringValue: SCRAM-SHA-1 - key: t value: kvlistValue: @@ -789,7 +795,7 @@ resourceLogs: - key: $date value: stringValue: "2023-04-26T02:38:56.267+00:00" - observedTimeUnixNano: "1682740133575250000" + observedTimeUnixNano: "1698948019769963000" severityNumber: 13 severityText: Warn spanId: "" @@ -820,9 +826,6 @@ resourceLogs: body: kvlistValue: values: - - key: c - value: - stringValue: ACCESS - key: id value: doubleValue: 20249 @@ -836,6 +839,12 @@ resourceLogs: value: kvlistValue: values: + - key: mechanism + value: + stringValue: SCRAM-SHA-1 + - key: speculative + value: + boolValue: true - key: principalName value: stringValue: mms-automation @@ -851,12 +860,6 @@ resourceLogs: - key: error value: stringValue: 'UserNotFound: User "mms-automation@admin" not found' - - key: mechanism - value: - stringValue: SCRAM-SHA-1 - - key: speculative - value: - boolValue: true - key: t value: kvlistValue: @@ -867,7 +870,10 @@ resourceLogs: - key: s value: stringValue: I - observedTimeUnixNano: "1682740133575250000" + - key: c + value: + stringValue: ACCESS + observedTimeUnixNano: "1698948019769963000" severityNumber: 13 severityText: Warn spanId: "" @@ -914,6 +920,12 @@ resourceLogs: value: kvlistValue: values: + - key: mechanism + value: + stringValue: SCRAM-SHA-1 + - key: speculative + value: + boolValue: false - key: principalName value: stringValue: mms-automation @@ -929,12 +941,6 @@ resourceLogs: - key: error value: stringValue: 'UserNotFound: User "mms-automation@admin" not found' - - key: mechanism - value: - stringValue: SCRAM-SHA-1 - - key: speculative - value: - boolValue: false - key: t value: kvlistValue: @@ -945,7 +951,7 @@ resourceLogs: - key: s value: stringValue: I - observedTimeUnixNano: "1682740133575250000" + observedTimeUnixNano: "1698948019769963000" severityNumber: 13 severityText: Warn spanId: "" @@ -1011,7 +1017,7 @@ resourceLogs: - key: s value: stringValue: I - observedTimeUnixNano: "1682740133575250000" + observedTimeUnixNano: "1698948019769963000" severityNumber: 9 severityText: Info spanId: "" @@ -1039,27 +1045,11 @@ resourceLogs: body: kvlistValue: values: - - key: attr + - key: t value: kvlistValue: values: - - key: client - value: - stringValue: 555.555.555.555:19814 - - key: mechanism - value: - stringValue: MONGODB-X509 - - key: user - value: - stringValue: CN=devops@myapp.com/xgen-readAnyDatabaseAtadmin - - key: db - value: - stringValue: $external - - key: t - value: - kvlistValue: - values: - - key: $date + - key: $date value: stringValue: "2023-04-26T02:03:57.290+00:00" - key: s @@ -1077,7 +1067,23 @@ resourceLogs: - key: msg value: stringValue: Successfully authenticated - observedTimeUnixNano: "1682740133575250000" + - key: attr + value: + kvlistValue: + values: + - key: db + value: + stringValue: $external + - key: client + value: + stringValue: 555.555.555.555:19814 + - key: mechanism + value: + stringValue: MONGODB-X509 + - key: user + value: + stringValue: CN=devops@myapp.com/xgen-readAnyDatabaseAtadmin + observedTimeUnixNano: "1698948019769963000" severityNumber: 9 severityText: Info spanId: "" @@ -1105,6 +1111,12 @@ resourceLogs: body: kvlistValue: values: + - key: id + value: + doubleValue: 20429 + - key: ctx + value: + stringValue: conn1748 - key: msg value: stringValue: Successfully authenticated @@ -1137,13 +1149,7 @@ resourceLogs: - key: c value: stringValue: ACCESS - - key: id - value: - doubleValue: 20429 - - key: ctx - value: - stringValue: conn1748 - observedTimeUnixNano: "1682740133575250000" + observedTimeUnixNano: "1698948019769963000" severityNumber: 9 severityText: Info spanId: "" @@ -1171,9 +1177,6 @@ resourceLogs: body: kvlistValue: values: - - key: c - value: - stringValue: ACCESS - key: id value: doubleValue: 20429 @@ -1187,9 +1190,6 @@ resourceLogs: value: kvlistValue: values: - - key: client - value: - stringValue: 555.555.555.555:22849 - key: mechanism value: stringValue: MONGODB-X509 @@ -1199,6 +1199,9 @@ resourceLogs: - key: db value: stringValue: $external + - key: client + value: + stringValue: 555.555.555.555:22849 - key: t value: kvlistValue: @@ -1209,7 +1212,10 @@ resourceLogs: - key: s value: stringValue: I - observedTimeUnixNano: "1682740133575250000" + - key: c + value: + stringValue: ACCESS + observedTimeUnixNano: "1698948019769963000" severityNumber: 9 severityText: Info spanId: "" @@ -1256,6 +1262,9 @@ resourceLogs: value: kvlistValue: values: + - key: client + value: + stringValue: 555.555.555.555:61698 - key: mechanism value: stringValue: MONGODB-X509 @@ -1265,9 +1274,6 @@ resourceLogs: - key: db value: stringValue: $external - - key: client - value: - stringValue: 555.555.555.555:61698 - key: t value: kvlistValue: @@ -1275,7 +1281,7 @@ resourceLogs: - key: $date value: stringValue: "2023-04-26T02:03:53.975+00:00" - observedTimeUnixNano: "1682740133575250000" + observedTimeUnixNano: "1698948019769963000" severityNumber: 9 severityText: Info spanId: "" @@ -1319,18 +1325,18 @@ resourceLogs: value: kvlistValue: values: - - key: user - value: - stringValue: CN=devops@myapp.com/xgen-readAnyDatabaseAtadmin - - key: db - value: - stringValue: $external - key: client value: stringValue: 555.555.555.555:54375 - key: mechanism value: stringValue: MONGODB-X509 + - key: user + value: + stringValue: CN=devops@myapp.com/xgen-readAnyDatabaseAtadmin + - key: db + value: + stringValue: $external - key: t value: kvlistValue: @@ -1341,7 +1347,7 @@ resourceLogs: - key: s value: stringValue: I - observedTimeUnixNano: "1682740133575250000" + observedTimeUnixNano: "1698948019769963000" severityNumber: 9 severityText: Info spanId: "" @@ -1369,13 +1375,6 @@ resourceLogs: body: kvlistValue: values: - - key: t - value: - kvlistValue: - values: - - key: $date - value: - stringValue: "2023-04-26T01:41:40.865+00:00" - key: s value: stringValue: I @@ -1395,6 +1394,15 @@ resourceLogs: value: kvlistValue: values: + - key: speculative + value: + boolValue: true + - key: principalName + value: + stringValue: test_user + - key: authenticationDatabase + value: + stringValue: admin - key: remote value: stringValue: 555.555.555.555:61869 @@ -1404,16 +1412,14 @@ resourceLogs: - key: mechanism value: stringValue: SCRAM-SHA-256 - - key: speculative - value: - boolValue: true - - key: principalName - value: - stringValue: test_user - - key: authenticationDatabase + - key: t + value: + kvlistValue: + values: + - key: $date value: - stringValue: admin - observedTimeUnixNano: "1682740133575250000" + stringValue: "2023-04-26T01:41:40.865+00:00" + observedTimeUnixNano: "1698948019769963000" severityNumber: 9 severityText: Info spanId: "" @@ -1441,28 +1447,6 @@ resourceLogs: body: kvlistValue: values: - - key: attr - value: - kvlistValue: - values: - - key: principalName - value: - stringValue: test_user - - key: authenticationDatabase - value: - stringValue: admin - - key: remote - value: - stringValue: 555.555.555.555:61867 - - key: extraInfo - value: - kvlistValue: {} - - key: mechanism - value: - stringValue: SCRAM-SHA-256 - - key: speculative - value: - boolValue: true - key: t value: kvlistValue: @@ -1485,7 +1469,29 @@ resourceLogs: - key: msg value: stringValue: Authentication succeeded - observedTimeUnixNano: "1682740133575250000" + - key: attr + value: + kvlistValue: + values: + - key: mechanism + value: + stringValue: SCRAM-SHA-256 + - key: speculative + value: + boolValue: true + - key: principalName + value: + stringValue: test_user + - key: authenticationDatabase + value: + stringValue: admin + - key: remote + value: + stringValue: 555.555.555.555:61867 + - key: extraInfo + value: + kvlistValue: {} + observedTimeUnixNano: "1698948019769963000" severityNumber: 9 severityText: Info spanId: "" @@ -1513,6 +1519,12 @@ resourceLogs: body: kvlistValue: values: + - key: c + value: + stringValue: ACCESS + - key: id + value: + doubleValue: 20250 - key: ctx value: stringValue: conn1635 @@ -1523,15 +1535,6 @@ resourceLogs: value: kvlistValue: values: - - key: authenticationDatabase - value: - stringValue: admin - - key: remote - value: - stringValue: 555.555.555.555:61868 - - key: extraInfo - value: - kvlistValue: {} - key: mechanism value: stringValue: SCRAM-SHA-256 @@ -1541,6 +1544,15 @@ resourceLogs: - key: principalName value: stringValue: test_user + - key: authenticationDatabase + value: + stringValue: admin + - key: remote + value: + stringValue: 555.555.555.555:61868 + - key: extraInfo + value: + kvlistValue: {} - key: t value: kvlistValue: @@ -1551,13 +1563,7 @@ resourceLogs: - key: s value: stringValue: I - - key: c - value: - stringValue: ACCESS - - key: id - value: - doubleValue: 20250 - observedTimeUnixNano: "1682740133575250000" + observedTimeUnixNano: "1698948019769963000" severityNumber: 9 severityText: Info spanId: "" @@ -1585,6 +1591,25 @@ resourceLogs: body: kvlistValue: values: + - key: msg + value: + stringValue: Successfully authenticated + - key: attr + value: + kvlistValue: + values: + - key: client + value: + stringValue: 555.555.555.555:64040 + - key: mechanism + value: + stringValue: MONGODB-X509 + - key: user + value: + stringValue: CN=devops@myapp.com/xgen-readAnyDatabaseAtadmin + - key: db + value: + stringValue: $external - key: t value: kvlistValue: @@ -1604,26 +1629,7 @@ resourceLogs: - key: ctx value: stringValue: conn549 - - key: msg - value: - stringValue: Successfully authenticated - - key: attr - value: - kvlistValue: - values: - - key: mechanism - value: - stringValue: MONGODB-X509 - - key: user - value: - stringValue: CN=devops@myapp.com/xgen-readAnyDatabaseAtadmin - - key: db - value: - stringValue: $external - - key: client - value: - stringValue: 555.555.555.555:64040 - observedTimeUnixNano: "1682740133575250000" + observedTimeUnixNano: "1698948019769963000" severityNumber: 9 severityText: Info spanId: "" @@ -1651,6 +1657,19 @@ resourceLogs: body: kvlistValue: values: + - key: t + value: + kvlistValue: + values: + - key: $date + value: + stringValue: "2023-04-25T21:08:07.838+00:00" + - key: s + value: + stringValue: I + - key: c + value: + stringValue: ACCESS - key: id value: doubleValue: 20250 @@ -1664,6 +1683,12 @@ resourceLogs: value: kvlistValue: values: + - key: remote + value: + stringValue: 555.555.555.555:58284 + - key: extraInfo + value: + kvlistValue: {} - key: mechanism value: stringValue: SCRAM-SHA-256 @@ -1676,26 +1701,7 @@ resourceLogs: - key: authenticationDatabase value: stringValue: admin - - key: remote - value: - stringValue: 555.555.555.555:58284 - - key: extraInfo - value: - kvlistValue: {} - - key: t - value: - kvlistValue: - values: - - key: $date - value: - stringValue: "2023-04-25T21:08:07.838+00:00" - - key: s - value: - stringValue: I - - key: c - value: - stringValue: ACCESS - observedTimeUnixNano: "1682740133575250000" + observedTimeUnixNano: "1698948019769963000" severityNumber: 9 severityText: Info spanId: "" @@ -1723,13 +1729,6 @@ resourceLogs: body: kvlistValue: values: - - key: t - value: - kvlistValue: - values: - - key: $date - value: - stringValue: "2023-04-25T21:08:07.838+00:00" - key: s value: stringValue: I @@ -1749,6 +1748,15 @@ resourceLogs: value: kvlistValue: values: + - key: mechanism + value: + stringValue: SCRAM-SHA-256 + - key: speculative + value: + boolValue: true + - key: principalName + value: + stringValue: test_user - key: authenticationDatabase value: stringValue: admin @@ -1758,16 +1766,14 @@ resourceLogs: - key: extraInfo value: kvlistValue: {} - - key: mechanism - value: - stringValue: SCRAM-SHA-256 - - key: speculative - value: - boolValue: true - - key: principalName + - key: t + value: + kvlistValue: + values: + - key: $date value: - stringValue: test_user - observedTimeUnixNano: "1682740133575250000" + stringValue: "2023-04-25T21:08:07.838+00:00" + observedTimeUnixNano: "1698948019769963000" severityNumber: 9 severityText: Info spanId: ""