Skip to content

Commit

Permalink
BC-8339 last seven days security check on files (#1011)
Browse files Browse the repository at this point in the history
  • Loading branch information
Loki-Afro authored Oct 30, 2024
1 parent c09191a commit 2dd9ccb
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions ansible/roles/mongodb_query_exporter/templates/values.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -926,3 +926,44 @@ aggregations:
}
}
]


- database: {{ mongodb_query_exporter_mongodb_sc_db_name }}
collection: files
metrics:
- name: sc_files_security_check_last_seven_days
type: gauge
help: 'Legacy files scan results in the last 7 days'
value: total
overrideEmpty: true
emptyValue: 0
labels: [status]
constLabels: {}
mode: pull
pipeline: |
[
{ "$match": { "isDirectory": false, "securityCheck": { "$exists": true } } },
{
"$match": {
"$expr": {
"$gte": [
"$createdAt",
{ "$subtract": ["$$NOW", 604800000] }
]
}
}
},
{
"$group": {
"_id": "$securityCheck.status",
"total": { "$sum": 1 }
}
},
{
"$project": {
"_id": 0,
"status": "$_id",
"total": "$total"
}
}
]

0 comments on commit 2dd9ccb

Please sign in to comment.