Configure CxMongoOutput - checkmarx-ts/CxAnalytix GitHub Wiki
MongoDB Output Component Configuration
This configuration is only relevant if OutputFactoryClassPath="CxAnalytix.Out.MongoDBOutput.MongoDBOutFactory, MongoDBOutput"
appears in your configuration file.
Logging Config
When using the MongoDB Output component, it is not required to have Log4Net appenders beyond the normal Console
and RollingFileAppender
for logging DEBUG/INFO/WARN/ERROR messages to an application log. The loggers in the example file that are normally used for the CxLogOutput output method can be removed.
CxMongoOutput
Attribute | Required | Default Value | Description |
---|---|---|---|
ConnectionString | No | N/A | Deprecated, use CxMongoConnection |
Shard Key Generation
The GeneratedShardKeys
is optional and can contain zero or more Spec
elements that defines a calculated "shard" or "partition" key added to each record written to the collection with CollectionName
. The primary use-case for this is for cloud-based MongoDB API-compatible document stores that automatically scale storage allocation using a field defined in the root of the document.
In the Spec
element, the KeyName
attribute is the name of the field added to the document written in the the collection defined by the CollectionName
attribute. The FormatSpec
attribute contains a format specifier that builds the shard key from fields in the record. The NoHash
attribute is an optional boolean value that defaults to false
.
When the NoHash
attribute is false
, the shard key is composed and then written in the field as a Base-64 encoded SHA-256 hash. If set to true
, the shard key value is written as the raw text created from the format spec.
<CxMongoOutput>
<GeneratedShardKeys>
<Spec KeyName="pkey" CollectionName="SAST_Scan_Summary" FormatSpec="{ScanType}-{ScanFinished:yyyy-dddd}" />
<Spec KeyName="pkey" CollectionName="SAST_Scan_Detail" FormatSpec="{ScanType}-{QueryGroup}-{ScanFinished:yyyy-dddd}" NoHash="true" />
</GeneratedShardKeys>
</CxMongoOutput>