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

jamf_pro: normalize jamf_pro.inventory.operating_system.version and os.version to three-part versions #12834

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions packages/jamf_pro/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# newer versions go on top
- version: "0.3.0"
changes:
- description: Normalize `jamf_pro.inventory.operating_system.version` and `os.version` to three-part versions.
type: enhancement
link: https://github.com/elastic/integrations/pull/12834
- description: Add `os.full` for known OS versions.
type: enhancement
link: https://github.com/elastic/integrations/pull/12834
- version: "0.2.6"
changes:
- description: Updated SSL description in package manifest.yml to be uniform and to include links to documentation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,70 @@
"purchasing": null,
"udid": "21ED95A7-FF9D-52BD-A55B-36D54585083A"
}
},
{
"message": {
"applications": [
{
"bundleId": "com.apple.freeform",
"externalVersionId": "0",
"macAppStore": false,
"name": "Freeform.app",
"path": "/System/Applications/Freeform.app",
"sizeMegabytes": 57,
"updateAvailable": false,
"version": "2.4"
}
],
"operatingSystem": {
"activeDirectoryStatus": "Not Bound",
"build": "23H311",
"extensionAttributes": [],
"fileVault2Status": "NOT_ENCRYPTED",
"name": "macOS",
"rapidSecurityResponse": null,
"softwareUpdateDeviceId": "J314cAP",
"supplementalBuildVersion": "23H311",
"version": "14.7"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note this.

},
"packageReceipts": null,
"plugins": null,
"printers": null,
"purchasing": null,
"udid": "21ED95A7-FF9D-52BD-A55B-36D54585083A"
}
},
{
"message": {
"applications": [
{
"bundleId": "com.apple.freeform",
"externalVersionId": "0",
"macAppStore": false,
"name": "Freeform.app",
"path": "/System/Applications/Freeform.app",
"sizeMegabytes": 57,
"updateAvailable": false,
"version": "2.4"
}
],
"operatingSystem": {
"activeDirectoryStatus": "Not Bound",
"build": "23H311",
"extensionAttributes": [],
"fileVault2Status": "NOT_ENCRYPTED",
"name": "macOS",
"rapidSecurityResponse": null,
"softwareUpdateDeviceId": "J314cAP",
"supplementalBuildVersion": "23H311",
"version": "14"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note this.

},
"packageReceipts": null,
"plugins": null,
"printers": null,
"purchasing": null,
"udid": "21ED95A7-FF9D-52BD-A55B-36D54585083A"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@
}
},
"os": {
"full": "sonoma",
"name": "macOS",
"version": "14.7.2"
},
Expand All @@ -429,6 +430,94 @@
""
]
}
},
{
"ecs": {
"version": "8.11.0"
},
"event": {
"kind": "asset"
},
"jamf_pro": {
"inventory": {
"applications": [
{
"bundle_id": "com.apple.freeform",
"external_version_id": "0",
"mac_app_store": false,
"name": "Freeform.app",
"path": "/System/Applications/Freeform.app",
"size_megabytes": 57,
"update_available": false,
"version": "2.4"
}
],
"operating_system": {
"active_directory_status": "Not Bound",
"build": "23H311",
"file_vault2status": "NOT_ENCRYPTED",
"name": "macOS",
"software_update_device_id": "J314cAP",
"supplemental_build_version": "23H311",
"version": "14.7.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normalised.

},
"udid": "21ED95A7-FF9D-52BD-A55B-36D54585083A"
}
},
"os": {
"full": "sonoma",
"name": "macOS",
"version": "14.7.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normalised.

},
"related": {
"user": [
""
]
}
},
{
"ecs": {
"version": "8.11.0"
},
"event": {
"kind": "asset"
},
"jamf_pro": {
"inventory": {
"applications": [
{
"bundle_id": "com.apple.freeform",
"external_version_id": "0",
"mac_app_store": false,
"name": "Freeform.app",
"path": "/System/Applications/Freeform.app",
"size_megabytes": 57,
"update_available": false,
"version": "2.4"
}
],
"operating_system": {
"active_directory_status": "Not Bound",
"build": "23H311",
"file_vault2status": "NOT_ENCRYPTED",
"name": "macOS",
"software_update_device_id": "J314cAP",
"supplemental_build_version": "23H311",
"version": "14.0.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normalised.

},
"udid": "21ED95A7-FF9D-52BD-A55B-36D54585083A"
}
},
"os": {
"full": "sonoma",
"name": "macOS",
"version": "14.0.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normalised.

},
"related": {
"user": [
""
]
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,79 @@ processors:
field: os.name
copy_from: jamf_pro.inventory.operating_system.name
ignore_empty_value: true
- script:
tag: script_normalize_operating_system_version
lang: painless
if: ctx.jamf_pro?.inventory?.operating_system?.version != null && ctx.jamf_pro.inventory.operating_system.version != ''
source: |-
String normalize(String s) {
int n = 0;
for (int i = 0; i < s.length(); i++){
char c = s.charAt(i);
if (c == (char)'.') {
n++;
continue;
}
if (c < (char)'0' || (char)'9' < c) {
// If we have non-numeric parts, bail.
return s;
}
}
if (n >= 2) {
return s;
}
if (n == 1) {
return s + ".0";
}
return s + ".0.0";
}
String full_name(String s) {
if (s.startsWith('15.')) {
return 'sequoia';
}
if (s.startsWith('14.')) {
return 'sonoma';
}
if (s.startsWith('13.')) {
return 'ventura';
}
if (s.startsWith('12.')) {
return 'monterey';
}
if (s.startsWith('11.')) {
return 'big sur';
}
if (s.startsWith('10.15.')) {
return 'catalina';
}
if (s.startsWith('10.14.')) {
return 'mojave';
}
if (s.startsWith('10.13.')) {
return 'high sierra';
}
if (s.startsWith('10.12.')) {
return 'sierra';
}
if (s.startsWith('10.11.')) {
return 'el capitan';
}
if (s.startsWith('10.10.')) {
return 'yosemite';
}
if (s.startsWith('10.9.')) {
return 'mavericks';
}
return '';
}
ctx.jamf_pro.inventory.operating_system.version = normalize(ctx.jamf_pro.inventory.operating_system.version);
String name = full_name(ctx.jamf_pro.inventory.operating_system.version);
if (name != '') {
if (ctx.os == null) {
ctx.os = [:];
}
ctx.os.full = name;
}
- set:
field: os.version
copy_from: jamf_pro.inventory.operating_system.version
Expand Down
2 changes: 1 addition & 1 deletion packages/jamf_pro/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
format_version: 3.1.5
name: jamf_pro
title: "Jamf Pro"
version: 0.2.6
version: 0.3.0
source:
license: "Elastic-2.0"
description: "Collect logs and inventory data from Jamf Pro with Elastic Agent"
Expand Down