Skip to content

Conversation

@muskan-agarwal26
Copy link
Contributor

Proposed commit message

The initial release includes unified_log data stream and associated dashboard.

macOS fields are mapped to their corresponding ECS fields where possible.

Test samples were derived from live data samples.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.
  • I have verified that any added dashboard complies with Kibana's Dashboard good practices

How to test this PR locally

To test the macOS package:

  • Clone integrations repo.
  • Install elastic package locally.
  • Start elastic stack using elastic-package.
  • Move to integrations/packages/macos directory.
  • Run the following command to run tests.

elastic-package test

Run asset tests for the package
2025/10/29 15:10:56  INFO License text found in "/root/GITHUB/integrations/LICENSE.txt" will be included in package
--- Test results for package: macos - START ---
╭─────────┬─────────────┬───────────┬────────────────────────────────────────────────────────────────┬────────┬──────────────╮
│ PACKAGE │ DATA STREAM │ TEST TYPE │ TEST NAME                                                      │ RESULT │ TIME ELAPSED │
├─────────┼─────────────┼───────────┼────────────────────────────────────────────────────────────────┼────────┼──────────────┤
│ macos   │             │ asset     │ dashboard macos-4b49d421-2f03-4dd2-891f-cbd7e2786e35 is loaded │ PASS   │      1.622µs │
│ macos   │             │ asset     │ dashboard macos-4fae07f9-fff4-49d0-8ed6-54a63b4c6426 is loaded │ PASS   │        363ns │
│ macos   │ unified_log │ asset     │ index_template logs-macos.unified_log is loaded                │ PASS   │        739ns │
│ macos   │ unified_log │ asset     │ ingest_pipeline logs-macos.unified_log-0.1.0 is loaded         │ PASS   │        213ns │
╰─────────┴─────────────┴───────────┴────────────────────────────────────────────────────────────────┴────────┴──────────────╯
--- Test results for package: macos - END   ---
Done
Run pipeline tests for the package
--- Test results for package: macos - START ---
╭─────────┬─────────────┬───────────┬─────────────────────────────────────────────┬────────┬──────────────╮
│ PACKAGE │ DATA STREAM │ TEST TYPE │ TEST NAME                                   │ RESULT │ TIME ELAPSED │
├─────────┼─────────────┼───────────┼─────────────────────────────────────────────┼────────┼──────────────┤
│ macos   │ unified_log │ pipeline  │ (ingest pipeline warnings test-unified.log) │ PASS   │ 708.724132ms │
│ macos   │ unified_log │ pipeline  │ test-unified.log                            │ PASS   │ 964.410061ms │
╰─────────┴─────────────┴───────────┴─────────────────────────────────────────────┴────────┴──────────────╯
--- Test results for package: macos - END   ---
Done
Run policy tests for the package
--- Test results for package: macos - START ---
No test results
--- Test results for package: macos - END   ---
Done
Run static tests for the package
--- Test results for package: macos - START ---
No test results
--- Test results for package: macos - END   ---
Done
Run system tests for the package
--- Test results for package: macos - START ---
No test results
--- Test results for package: macos - END   ---
Done

Related issues

Screenshots

macos-1 macos-2

@muskan-agarwal26
Copy link
Contributor Author

Hi @cpascale43 , @narph , @nfritts , @leandrojmp , @P1llus , @marc-gr , @btrieger
Raised another PR for this integration as the fork earlier was removed unintentionally while organizing repositories.
Hence PR: #15794 was closed.
Please consider this for review.

@andrewkroh andrewkroh added New Integration Issue or pull request for creating a new integration package. dashboard Relates to a Kibana dashboard bug, enhancement, or modification. documentation Improvements or additions to documentation. Applied to PRs that modify *.md files. Crest Contributions from Crest developement team. labels Dec 1, 2025
@nfritts
Copy link

nfritts commented Dec 3, 2025

Does this have all of the feedback that had already been posted on the previous PR addressed? Is that being addressed or do those comments need to be re-added to this PR now?


This integration requires Elastic Agent to be installed on the macOS systems you want to monitor.

### Agent-based installation
Copy link

@cpascale43 cpascale43 Dec 3, 2025

Choose a reason for hiding this comment

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

Maybe another subheading here:

Should I use this integration if I already have Elastic Defend?

For comprehensive visibility, yes. Elastic Defend isn't designed to provide a complete capture of all system events and it's recommended to supplement it with the macOS unified logging integration.
Specifically, Elastic Defend on macOS does not capture:

  • All user login/logout events
  • Every user account creation, deletion, or modification
  • Complete system service registration and changes
  • Application diagnostic logs

This integration fills those gaps, similar to how Windows users supplement Elastic Defend with Custom Windows Event Logs integration. See Elastic Defend Event Capture documentation for details on what Elastic Defend does and doesn't capture.

Choose a reason for hiding this comment

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

@muskan-agarwal26 are you able to add this in? Thank you

@muskan-agarwal26
Copy link
Contributor Author

muskan-agarwal26 commented Dec 4, 2025

Does this have all of the feedback that had already been posted on the previous PR addressed? Is that being addressed or do those comments need to be re-added to this PR now?

Yes, @nfritts , All comments on the previous PR are addressed.

@marc-gr
Copy link
Contributor

marc-gr commented Dec 4, 2025

I think we should consider removing the preserve_duplicate_custom_fields functionality. I do not see what it might be its use, and would simplify every pipeline in the PR

@narph narph requested a review from a team December 8, 2025 09:10
@narph narph added the Team:Security-Windows Platform Security Windows Platform team [elastic/sec-windows-platform] label Dec 8, 2025
@elasticmachine
Copy link

Pinging @elastic/sec-windows-platform (Team:Security-Windows Platform)

@cpascale43
Copy link

@marc-gr is there anything else needed for your review? Thanks

1. Removed predicates from agent files and added in default values in manifest.
2. Removed preserve duplicate custom toggle
Copy link
Contributor

@marc-gr marc-gr left a comment

Choose a reason for hiding this comment

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

In addition to the comments I think system_change and network_activity could be refactored to extract their common bits into a common-network.yml pipeline since ~259 lines are duplicated, and only ~13 lines are unique per pipeline.

1. Created common network pipeline.
2. Added missing if cond.
3. set ignore_empty_value to false.
@marc-gr
Copy link
Contributor

marc-gr commented Jan 14, 2026

/test

@elastic-vault-github-plugin-prod

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

## 1. Removed Duplicate Grok Pattern

**File**: `_dev/shared/common-network-pipeline.yml`

**Issue**: Same grok pattern appeared twice on consecutive lines (copy-paste error).

**Fix**: Removed the duplicate line.

---

## 2. Created Proper Pipeline for `advanced_monitoring`

**File**: `data_stream/advanced_monitoring/elasticsearch/ingest_pipeline/default.yml`

**Issue**: `advanced_monitoring` used a `.link` file pointing directly to `common-pipeline.yml`, meaning it had no `event.category` or `event.type`.

**Fix**: Created a proper `default.yml` that sets `event.category: host` and `event.type: info` before calling the common pipeline.

---

## 3. Predicate Changes

### 3a. `advanced_monitoring` - Complete Rewrite

**File**: `data_stream/advanced_monitoring/manifest.yml`

**Before**:
```
- 'eventMessage CONTAINS[c] "exec" OR eventMessage CONTAINS[c] "fork" OR eventMessage CONTAINS[c] "exited" OR eventMessage CONTAINS[c] "terminated"'
- 'subsystem == "com.apple.securityd" AND (composedMessage CONTAINS "code signing" OR composedMessage CONTAINS "not valid")'
- 'composedMessage CONTAINS "com.apple.quarantine"'
```

**After**:
```
- 'subsystem == "com.apple.xpc" OR subsystem == "com.apple.launchd"'
- 'category == "performance" OR category == "diagnostics"'
- 'messageType == 16 OR messageType == 17'
```

**Why**: The original predicates were **identical** to `process_execution_monitoring`, meaning both data streams would collect the exact same events (duplicates). The new predicates focus on system internals (XPC/launchd services, performance diagnostics) which is semantically appropriate for "advanced monitoring".

### 3b. `process_execution_monitoring` - Removed Quarantine

**File**: `data_stream/process_execution_monitoring/manifest.yml`

**Removed**:
```
- 'composedMessage CONTAINS "com.apple.quarantine"'
```

**Why**: Quarantine is about downloaded file security, not process execution. The `file_read_write` data stream already captures quarantine events with `event.category: file`. Having both collect quarantine would cause duplicates with inconsistent categorization.

---

## 4. Updated Test Data

**Files**: `data_stream/*/test/pipeline/*.log`

**Issue**: Test events didn't match the new predicates after changes.

**Changes**:
- `advanced_monitoring`: Changed test events to use `com.apple.xpc` and `com.apple.launchd` subsystems
- `file_read_write`: Changed test events to include `open()` file operation and `com.apple.quarantine` subsystem

---

## 5. Fixed `system_change` Data Stream Architecture

**Files**:
- `data_stream/system_change/elasticsearch/ingest_pipeline/default.yml`
- `data_stream/system_change/manifest.yml`
- `data_stream/system_change/_dev/test/pipeline/test-system-change.log`

### 5a. Removed Unnecessary Network Pipeline

**Issue**: `system_change` was calling `common-network-pipeline.yml` which contains TCP/UDP grok patterns for parsing network connection strings. System change events (installer, security policy, software updates) don't contain network connection data.

**Fix**: Removed the `common-network-pipeline` call from the pipeline.

**Before**:
```yaml
- pipeline: { name: '{{ IngestPipeline "common-pipeline" }}' }
- pipeline: { name: '{{ IngestPipeline "common-network-pipeline" }}' }
```

**After**:
```yaml
- pipeline: { name: '{{ IngestPipeline "common-pipeline" }}' }
```

### 5b. Refined Predicate to Exclude Network Traffic

**Issue**: The predicate `process == "softwareupdated"` was too broad - it captured ALL logs from the `softwareupdated` process, including TCP/UDP network traffic from `com.apple.network` subsystem. This caused network events to incorrectly appear in the `system_change` data stream.

**Fix**: Added subsystem exclusion for `softwareupdated` matches.

**Before**:
```
process == "softwareupdated"
```

**After**:
```
(process == "softwareupdated" AND subsystem != "com.apple.network")
```

### 5c. Replaced Test Data

**Issue**: Test data contained TCP/UDP network connection logs instead of actual system change events.

**Fix**: Replaced with proper system change events:
- `com.apple.systempolicy` - Gatekeeper/system policy evaluations
- `com.apple.installer` - Package installation/removal
- `com.apple.security` - XProtect updates, security assessments
- `com.apple.SoftwareUpdate` - Catalog updates

---

## 6. Inlined Network Pipeline into `network_activity`

**Files Changed**:
- `data_stream/network_activity/elasticsearch/ingest_pipeline/default.yml` - Inlined all processing
- `_dev/shared/common-network-pipeline.yml` - **Deleted**
- `data_stream/network_activity/elasticsearch/ingest_pipeline/common-network-pipeline.yml.link` - **Deleted**
- `data_stream/system_change/elasticsearch/ingest_pipeline/common-network-pipeline.yml.link` - **Deleted**

**Rationale**: After removing `system_change`'s dependency on the network pipeline, `network_activity` was the only consumer of `common-network-pipeline.yml`. Having a shared pipeline for a single consumer adds unnecessary indirection.

**Result**: The network-specific processing (grok patterns for TCP/UDP, TLS handshake parsing, byte/packet calculations, related.hosts/related.ip enrichment) is now directly in `network_activity`'s `default.yml`.

---

## Final Predicate Overview

| Data Stream | Predicate Focus | event.category |
|-------------|-----------------|----------------|
| **advanced_monitoring** | XPC, launchd, performance/diagnostics | `host` |
| **authentication** | sudo, su, loginwindow, sshd | `authentication` |
| **file_read_write** | File ops (open/write/unlink/rename) + quarantine | `file` |
| **network_activity** | TCP/UDP connections, disconnect, NECP | `network` |
| **process_execution_monitoring** | exec/fork/exit/terminate, code signing | `process` |
| **system_change** | Security policy, installer, software updates | `configuration` |
| **user_and_account_management** | sysadminctl, dscl, admin operations | `iam` |

All predicates are now unique with no overlapping event collection.
@marc-gr
Copy link
Contributor

marc-gr commented Jan 14, 2026

/test

@marc-gr
Copy link
Contributor

marc-gr commented Jan 14, 2026

/test

@elasticmachine
Copy link

💚 Build Succeeded

History

@marc-gr
Copy link
Contributor

marc-gr commented Jan 14, 2026

we need a review from @elastic/integrations-triaging

@marc-gr marc-gr merged commit a69615e into elastic:main Jan 15, 2026
9 checks passed
@elastic-vault-github-plugin-prod

Package macos - 0.1.0 containing this change is available at https://epr.elastic.co/package/macos/0.1.0/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Crest Contributions from Crest developement team. dashboard Relates to a Kibana dashboard bug, enhancement, or modification. documentation Improvements or additions to documentation. Applied to PRs that modify *.md files. Integration:macos macOS New Integration Issue or pull request for creating a new integration package. Team:Security-Windows Platform Security Windows Platform team [elastic/sec-windows-platform]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants