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

BC-8339 last seven days security check on files #1011

Merged
merged 1 commit into from
Oct 30, 2024
Merged
Changes from all commits
Commits
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
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"
}
}
]