Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

add splunk hec

Justin D'Souza9da9fcd46acf
diff --git a/README.md b/README.md
index f24837aa..1a155400 100644
--- a/README.md
+++ b/README.md
@@ -27,7 +27,8 @@ and file changes across local agent harnesses.
Beacon runs locally on the endpoint, captures supported activity from Claude
Code, Codex CLI, Claude Cowork, and Cursor, and normalizes it into
Wazuh-compatible JSONL for existing localfile/Wazuh or customer-managed
-pipelines.
+pipelines. Splunk HEC forwarding is available as an optional collector
+destination for teams that want direct SIEM ingestion.
<p align="center">
<img src="images/beacon-architecture.png" alt="Beacon endpoint architecture" width="860">
@@ -42,7 +43,8 @@ pipelines.
- **Security-team friendly:** ships macOS package assets for Jamf Pro and Fleet
deployment, validation, repair, and inventory.
- **SIEM-ready output:** writes Wazuh-compatible JSONL for local or
- customer-managed forwarding.
+ customer-managed forwarding, with optional Splunk HEC export through the
+ bundled collector.
## Table Of Contents
@@ -122,13 +124,17 @@ Beacon can currently:
activity, approval decisions, and file edits where Cursor exposes those hook
payloads.
- **Collector export:** convert OTLP logs, traces, metrics, and resource
- attributes into Beacon endpoint JSONL with the `beaconjson` collector exporter.
+ attributes into Beacon endpoint JSONL with the `beaconjson` collector exporter,
+ and optionally forward the same OTLP signals to Splunk HEC.
- **Local JSONL output:** write Wazuh-compatible JSONL to a local runtime log.
- **Local dashboard:** run a local-only dashboard for inspecting runtime
inventory, summaries, timelines, filters, and event details from the JSONL
log.
- **Wazuh content:** generate Wazuh localfile/rule content for the Beacon event
schema.
+- **Splunk HEC forwarding:** send logs, traces, and metrics to a
+ customer-managed Splunk HTTP Event Collector while preserving the local JSONL
+ audit log.
See the
[architecture](https://docs.asymptotelabs.ai/cli/architecture),
@@ -153,7 +159,7 @@ how retention settings are applied during install and repair.
Beacon does not currently provide kernel/process monitoring, shell history
collection, cloud audit ingestion, browser/SaaS telemetry, credential-use
-attribution, MCP configuration inventory, or direct Datadog/Splunk/Elastic/etc.
+attribution, MCP configuration inventory, or direct Datadog/Elastic/etc.
exporters.
For current support boundaries, see
@@ -235,6 +241,19 @@ See [Wazuh](https://docs.asymptotelabs.ai/cli/wazuh) and
[SIEM Forwarding](https://docs.asymptotelabs.ai/cli/siem-forwarding) for
production forwarding guidance.
+### Configure Splunk HEC Forwarding
+
+```bash
+beacon endpoint install \
+ --splunk-hec-endpoint https://splunk.example:8088/services/collector \
+ --splunk-hec-token "$SPLUNK_HEC_TOKEN" \
+ --splunk-index beacon
+```
+
+Splunk forwarding is additive: Beacon still writes the local runtime JSONL log,
+and the bundled collector also sends logs, traces, and metrics to the configured
+HEC endpoint.
+
### Run The macOS Smoke Test
```bash
diff --git a/cli/beacon/README.md b/cli/beacon/README.md
index ab063bab..5b78d669 100644
--- a/cli/beacon/README.md
+++ b/cli/beacon/README.md
@@ -23,6 +23,18 @@ Endpoint commands use per-user paths by default so hook and OTLP telemetry share
`~/.beacon/endpoint/logs/runtime.jsonl`. Use `--system` for root-managed
deployment paths.
+Add optional Splunk HEC forwarding during install or repair:
+
+```bash
+./beacon endpoint install \
+ --splunk-hec-endpoint https://splunk.example:8088/services/collector \
+ --splunk-hec-token "$SPLUNK_HEC_TOKEN" \
+ --splunk-index beacon
+```
+
+The local JSONL runtime log remains enabled when Splunk forwarding is
+configured.
+
## Dashboard
```bash
diff --git a/cli/beacon/cmd/endpoint.go b/cli/beacon/cmd/endpoint.go
index 045aeefd..023d7855 100644
--- a/cli/beacon/cmd/endpoint.go
+++ b/cli/beacon/cmd/endpoint.go
@@ -42,6 +42,13 @@ var endpointOpts struct {
coworkSince string
hookLevel string
contentRetention string
+ splunkHECEndpoint string
+ splunkHECToken string
+ splunkIndex string
+ splunkSource string
+ splunkSourcetype string
+ splunkInsecureSkipVerify bool
+ splunkCAFile string
dashboardAddr string
dashboardOpen bool
}
@@ -258,12 +265,14 @@ func init() {
endpointInstallCmd.Flags().StringVar(&endpointOpts.collectorPath, "collector", "", "Path to a beacon-otelcol binary")
endpointInstallCmd.Flags().BoolVar(&endpointOpts.noStart, "no-start", false, "Write files without starting the launchd service")
endpointInstallCmd.Flags().StringVar(&endpointOpts.contentRetention, "content-retention", "full", "Content retention mode: metadata, redacted, or full")
+ registerSplunkFlags(endpointInstallCmd)
endpointRepairCmd.Flags().StringVar(&endpointOpts.harnesses, "harness", "claude,codex", "Comma-separated harnesses to configure")
endpointRepairCmd.Flags().IntVar(&endpointOpts.grpcPort, "otlp-grpc-port", endpointconfig.DefaultGRPCPort, "Local OTLP gRPC port")
endpointRepairCmd.Flags().IntVar(&endpointOpts.httpPort, "otlp-http-port", endpointconfig.DefaultHTTPPort, "Local OTLP HTTP port")
endpointRepairCmd.Flags().StringVar(&endpointOpts.collectorPath, "collector", "", "Path to a beacon-otelcol binary")
endpointRepairCmd.Flags().BoolVar(&endpointOpts.noStart, "no-start", false, "Write files without starting the launchd service")
endpointRepairCmd.Flags().StringVar(&endpointOpts.contentRetention, "content-retention", "full", "Content retention mode: metadata, redacted, or full")
+ registerSplunkFlags(endpointRepairCmd)
endpointDashboardCmd.Flags().BoolVar(&endpointOpts.userMode, "user", true, "Use per-user endpoint paths")
endpointDashboardCmd.Flags().BoolVar(&endpointOpts.systemMode, "system", false, "Use system endpoint paths and launch daemon")
endpointDashboardCmd.Flags().StringVar(&endpointOpts.logPath, "log-path", "", "Runtime JSONL log path")
@@ -425,6 +434,7 @@ func runEndpointInstall(cmd *cobra.Command, args []string) error {
CollectorPath: endpointOpts.collectorPath,
StartService: !endpointOpts.noStart,
ContentRetention: endpointconfig.ContentRetention(endpointOpts.contentRetention),
+ SplunkHEC: splunkHECOptions(),
})
if err != nil {
return err
@@ -545,6 +555,7 @@ func runEndpointRepair(cmd *cobra.Command, args []string) error {
CollectorPath: endpointOpts.collectorPath,
StartService: !endpointOpts.noStart,
ContentRetention: endpointconfig.ContentRetention(endpointOpts.contentRetention),
+ SplunkHEC: splunkHECOptions(),
})
if err != nil {
return err
@@ -583,3 +594,34 @@ func splitCSV(value string) []string {
}
return out
}
+
+func registerSplunkFlags(cmd *cobra.Command) {
+ cmd.Flags().StringVar(&endpointOpts.splunkHECEndpoint, "splunk-hec-endpoint", "", "Splunk HEC endpoint URL")
+ cmd.Flags().StringVar(&endpointOpts.splunkHECToken, "splunk-hec-token", "", "Splunk HEC token")
+ cmd.Flags().StringVar(&endpointOpts.splunkIndex, "splunk-index", "", "Optional Splunk index")
+ cmd.Flags().StringVar(&endpointOpts.splunkSource, "splunk-source", endpointconfig.DefaultSplunkSource, "Optional Splunk source")
+ cmd.Flags().StringVar(&endpointOpts.splunkSourcetype, "splunk-sourcetype", endpointconfig.DefaultSplunkSourcetype, "Optional Splunk sourcetype")
+ cmd.Flags().BoolVar(&endpointOpts.splunkInsecureSkipVerify, "splunk-insecure-skip-verify", false, "Skip Splunk HEC TLS certificate verification")
+ cmd.Flags().StringVar(&endpointOpts.splunkCAFile, "splunk-ca-file", "", "Optional CA certificate path for Splunk HEC TLS verification")
+}
+
+func splunkHECOptions() *endpointconfig.SplunkHEC {
+ if endpointOpts.splunkHECEndpoint == "" &&
+ endpointOpts.splunkHECToken == "" &&
+ endpointOpts.splunkIndex == "" &&
+ endpointOpts.splunkSource == endpointconfig.DefaultSplunkSource &&
+ endpointOpts.splunkSourcetype == endpointconfig.DefaultSplunkSourcetype &&
+ !endpointOpts.splunkInsecureSkipVerify &&
+ endpointOpts.splunkCAFile == "" {
+ return nil
+ }
+ return &endpointconfig.SplunkHEC{
+ Endpoint: endpointOpts.splunkHECEndpoint,
+ Token: endpointOpts.splunkHECToken,
+ Index: endpointOpts.splunkIndex,
+ Source: endpointOpts.splunkSource,
+ Sourcetype: endpointOpts.splunkSourcetype,
+ InsecureSkipVerify: endpointOpts.splunkInsecureSkipVerify,
+ CAFile: endpointOpts.splunkCAFile,
+ }
+}
diff --git a/cli/beacon/cmd/endpoint_test.go b/cli/beacon/cmd/endpoint_test.go
index 8cd8b942..db5a6bea 100644
--- a/cli/beacon/cmd/endpoint_test.go
+++ b/cli/beacon/cmd/endpoint_test.go
@@ -98,6 +98,24 @@ func TestEndpointRepairSupportsNoStart(t *testing.T) {
}
}
+func TestEndpointInstallAndRepairSupportSplunkFlags(t *testing.T) {
+ for _, cmd := range []*cobra.Command{endpointInstallCmd, endpointRepairCmd} {
+ for _, name := range []string{
+ "splunk-hec-endpoint",
+ "splunk-hec-token",
+ "splunk-index",
+ "splunk-source",
+ "splunk-sourcetype",
+ "splunk-insecure-skip-verify",
+ "splunk-ca-file",
+ } {
+ if cmd.Flags().Lookup(name) == nil {
+ t.Fatalf("%s command missing --%s flag", cmd.Use, name)
+ }
+ }
+ }
+}
+
func TestEndpointCommandsDefaultToUserMode(t *testing.T) {
for _, cmd := range []*cobra.Command{endpointInstallCmd, endpointStatusCmd, endpointDashboardCmd, endpointHooksInstallCmd} {
userFlag := cmd.Flags().Lookup("user")
diff --git a/cli/beacon/internal/endpoint/collector/collector.go b/cli/beacon/internal/endpoint/collector/collector.go
index 1a8535b2..9b195af5 100644
--- a/cli/beacon/internal/endpoint/collector/collector.go
+++ b/cli/beacon/internal/endpoint/collector/collector.go
@@ -6,6 +6,7 @@ import (
"os"
"os/exec"
"path/filepath"
+ "strings"
endpointconfig "github.com/asymptote-labs/agent-beacon/cli/beacon/internal/endpoint/config"
)
@@ -84,16 +85,36 @@ func validateExecutable(path string) error {
}
func WriteConfig(cfg endpointconfig.Config) error {
+ endpointconfig.NormalizeDestinations(&cfg)
+ if err := endpointconfig.ValidateDestinations(cfg.Destinations); err != nil {
+ return err
+ }
if err := os.MkdirAll(filepath.Dir(cfg.Collector.ConfigPath), 0755); err != nil {
return err
}
if err := os.MkdirAll(filepath.Dir(cfg.Collector.SpoolPath), 0755); err != nil {
return err
}
- return os.WriteFile(cfg.Collector.ConfigPath, []byte(ConfigYAML(cfg)), 0644)
+ perm := os.FileMode(0644)
+ if endpointconfig.HasSecretDestinations(cfg) {
+ perm = 0600
+ }
+ if err := os.WriteFile(cfg.Collector.ConfigPath, []byte(ConfigYAML(cfg)), perm); err != nil {
+ return err
+ }
+ if endpointconfig.HasSecretDestinations(cfg) {
+ return os.Chmod(cfg.Collector.ConfigPath, perm)
+ }
+ return nil
}
func ConfigYAML(cfg endpointconfig.Config) string {
+ endpointconfig.NormalizeDestinations(&cfg)
+ exporters := "[beaconjson]"
+ splunkExporter := splunkHECYAML(cfg)
+ if splunkExporter != "" {
+ exporters = "[beaconjson, splunk_hec]"
+ }
return fmt.Sprintf(`receivers:
otlp:
protocols:
@@ -117,7 +138,7 @@ exporters:
rotate_bytes: 10485760
redact_secrets: true
content_retention: %q
-
+%s
extensions:
health_check:
endpoint: 127.0.0.1:13133
@@ -131,16 +152,46 @@ service:
logs:
receivers: [otlp]
processors: [memory_limiter, batch]
- exporters: [beaconjson]
+ exporters: %s
traces:
receivers: [otlp]
processors: [memory_limiter, batch]
- exporters: [beaconjson]
+ exporters: %s
metrics:
receivers: [otlp]
processors: [memory_limiter, batch]
- exporters: [beaconjson]
-`, cfg.Collector.GRPCPort, cfg.Collector.HTTPPort, cfg.LogPath, cfg.ContentRetention)
+ exporters: %s
+`, cfg.Collector.GRPCPort, cfg.Collector.HTTPPort, cfg.LogPath, cfg.ContentRetention, splunkExporter, exporters, exporters, exporters)
+}
+
+func splunkHECYAML(cfg endpointconfig.Config) string {
+ if cfg.Destinations == nil || cfg.Destinations.SplunkHEC == nil || !cfg.Destinations.SplunkHEC.Enabled {
+ return ""
+ }
+ splunk := cfg.Destinations.SplunkHEC
+ var b strings.Builder
+ fmt.Fprintf(&b, " splunk_hec:\n")
+ fmt.Fprintf(&b, " token: %q\n", splunk.Token)
+ fmt.Fprintf(&b, " endpoint: %q\n", splunk.Endpoint)
+ if splunk.Source != "" {
+ fmt.Fprintf(&b, " source: %q\n", splunk.Source)
+ }
+ if splunk.Sourcetype != "" {
+ fmt.Fprintf(&b, " sourcetype: %q\n", splunk.Sourcetype)
+ }
+ if splunk.Index != "" {
+ fmt.Fprintf(&b, " index: %q\n", splunk.Index)
+ }
+ if splunk.InsecureSkipVerify || splunk.CAFile != "" {
+ fmt.Fprintf(&b, " tls:\n")
+ if splunk.InsecureSkipVerify {
+ fmt.Fprintf(&b, " insecure_skip_verify: true\n")
+ }
+ if splunk.CAFile != "" {
+ fmt.Fprintf(&b, " ca_file: %q\n", splunk.CAFile)
+ }
+ }
+ return b.String()
}
func CheckStatus(cfg endpointconfig.Config) Status {
diff --git a/cli/beacon/internal/endpoint/collector/collector_test.go b/cli/beacon/internal/endpoint/collector/collector_test.go
index fbed89b2..5c13dde1 100644
--- a/cli/beacon/internal/endpoint/collector/collector_test.go
+++ b/cli/beacon/internal/endpoint/collector/collector_test.go
@@ -51,6 +51,38 @@ func TestConfigYAMLIncludesReleaseContractFields(t *testing.T) {
}
}
+func TestConfigYAMLIncludesSplunkHECWhenConfigured(t *testing.T) {
+ cfg := testConfig(t)
+ cfg.Destinations = &endpointconfig.Destinations{SplunkHEC: &endpointconfig.SplunkHEC{
+ Endpoint: "https://splunk.example:8088/services/collector",
+ Token: "hec-token",
+ Index: "beacon",
+ Source: "beacon-endpoint-agent",
+ Sourcetype: "beacon:endpoint",
+ InsecureSkipVerify: true,
+ CAFile: "/tmp/ca.pem",
+ }}
+
+ yaml := ConfigYAML(cfg)
+
+ for _, want := range []string{
+ "splunk_hec:",
+ `token: "hec-token"`,
+ `endpoint: "https://splunk.example:8088/services/collector"`,
+ `index: "beacon"`,
+ `source: "beacon-endpoint-agent"`,
+ `sourcetype: "beacon:endpoint"`,
+ "tls:",
+ "insecure_skip_verify: true",
+ `ca_file: "/tmp/ca.pem"`,
+ "exporters: [beaconjson, splunk_hec]",
+ } {
+ if !strings.Contains(yaml, want) {
+ t.Fatalf("ConfigYAML missing %q:\n%s", want, yaml)
+ }
+ }
+}
+
func TestWriteConfigCreatesConfigAndSpoolDirectory(t *testing.T) {
cfg := testConfig(t)
@@ -65,6 +97,25 @@ func TestWriteConfigCreatesConfigAndSpoolDirectory(t *testing.T) {
}
}
+func TestWriteConfigUsesPrivatePermissionsWithSplunkToken(t *testing.T) {
+ cfg := testConfig(t)
+ cfg.Destinations = &endpointconfig.Destinations{SplunkHEC: &endpointconfig.SplunkHEC{
+ Endpoint: "https://splunk.example:8088/services/collector",
+ Token: "hec-token",
+ }}
+
+ if err := WriteConfig(cfg); err != nil {
+ t.Fatalf("WriteConfig returned error: %v", err)
+ }
+ info, err := os.Stat(cfg.Collector.ConfigPath)
+ if err != nil {
+ t.Fatalf("stat collector config: %v", err)
+ }
+ if got, want := info.Mode().Perm(), os.FileMode(0600); got != want {
+ t.Fatalf("collector config permissions = %o, want %o", got, want)
+ }
+}
+
func TestDiscoverBinaryPrefersConfiguredExistingPath(t *testing.T) {
bin := filepath.Join(t.TempDir(), BinaryName)
if err := os.WriteFile(bin, []byte("#!/bin/sh\n"), 0755); err != nil {
diff --git a/cli/beacon/internal/endpoint/config/config.go b/cli/beacon/internal/endpoint/config/config.go
index 335e4ad5..95135f81 100644
--- a/cli/beacon/internal/endpoint/config/config.go
+++ b/cli/beacon/internal/endpoint/config/config.go
@@ -14,6 +14,11 @@ const (
DefaultHTTPPort = 4318
)
+const (
+ DefaultSplunkSource = "beacon-endpoint-agent"
+ DefaultSplunkSourcetype = "beacon:endpoint"
+)
+
type ContentRetention string
const (
@@ -29,6 +34,7 @@ type Config struct {
Harnesses []string `json:"harnesses"`
EventCategories []string `json:"event_categories,omitempty"`
ContentRetention ContentRetention `json:"content_retention"`
+ Destinations *Destinations `json:"destinations,omitempty"`
}
type Collector struct {
@@ -39,6 +45,21 @@ type Collector struct {
SpoolPath string `json:"spool_path,omitempty"`
}
+type Destinations struct {
+ SplunkHEC *SplunkHEC `json:"splunk_hec,omitempty"`
+}
+
+type SplunkHEC struct {
+ Enabled bool `json:"enabled,omitempty"`
+ Endpoint string `json:"endpoint,omitempty"`
+ Token string `json:"token,omitempty"`
+ Index string `json:"index,omitempty"`
+ Source string `json:"source,omitempty"`
+ Sourcetype string `json:"sourcetype,omitempty"`
+ InsecureSkipVerify bool `json:"insecure_skip_verify,omitempty"`
+ CAFile string `json:"ca_file,omitempty"`
+}
+
func Default(userMode bool, logPath string) Config {
base := BaseDir(userMode)
return Config{
@@ -93,6 +114,10 @@ func Load(userMode bool) (Config, error) {
if err := ValidateContentRetention(cfg.ContentRetention); err != nil {
return Config{}, err
}
+ NormalizeDestinations(&cfg)
+ if err := ValidateDestinations(cfg.Destinations); err != nil {
+ return Config{}, err
+ }
return cfg, nil
}
@@ -103,6 +128,10 @@ func Save(cfg Config) (string, error) {
if err := ValidateContentRetention(cfg.ContentRetention); err != nil {
return "", err
}
+ NormalizeDestinations(&cfg)
+ if err := ValidateDestinations(cfg.Destinations); err != nil {
+ return "", err
+ }
path := ConfigPath(cfg.UserMode)
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
return "", err
@@ -111,7 +140,17 @@ func Save(cfg Config) (string, error) {
if err != nil {
return "", err
}
- return path, os.WriteFile(path, data, 0644)
+ perm := os.FileMode(0644)
+ if HasSecretDestinations(cfg) {
+ perm = 0600
+ }
+ if err := os.WriteFile(path, data, perm); err != nil {
+ return "", err
+ }
+ if HasSecretDestinations(cfg) {
+ return path, os.Chmod(path, perm)
+ }
+ return path, nil
}
func ValidateContentRetention(mode ContentRetention) error {
@@ -122,3 +161,53 @@ func ValidateContentRetention(mode ContentRetention) error {
return fmt.Errorf("content retention must be metadata, redacted, or full")
}
}
+
+func NormalizeDestinations(cfg *Config) {
+ if cfg == nil || cfg.Destinations == nil || cfg.Destinations.SplunkHEC == nil {
+ return
+ }
+ splunk := cfg.Destinations.SplunkHEC
+ if splunk.Endpoint != "" || splunk.Token != "" {
+ splunk.Enabled = true
+ }
+ if !splunk.Enabled {
+ return
+ }
+ if splunk.Source == "" {
+ splunk.Source = DefaultSplunkSource
+ }
+ if splunk.Sourcetype == "" {
+ splunk.Sourcetype = DefaultSplunkSourcetype
+ }
+}
+
+func ValidateDestinations(destinations *Destinations) error {
+ if destinations == nil || destinations.SplunkHEC == nil {
+ return nil
+ }
+ splunk := destinations.SplunkHEC
+ configured := splunk.Enabled ||
+ splunk.Endpoint != "" ||
+ splunk.Token != "" ||
+ splunk.Index != "" ||
+ splunk.Source != "" ||
+ splunk.Sourcetype != "" ||
+ splunk.InsecureSkipVerify ||
+ splunk.CAFile != ""
+ if !configured {
+ return nil
+ }
+ if splunk.Endpoint == "" {
+ return fmt.Errorf("splunk HEC endpoint is required when Splunk forwarding is configured")
+ }
+ if splunk.Token == "" {
+ return fmt.Errorf("splunk HEC token is required when Splunk forwarding is configured")
+ }
+ return nil
+}
+
+func HasSecretDestinations(cfg Config) bool {
+ return cfg.Destinations != nil &&
+ cfg.Destinations.SplunkHEC != nil &&
+ cfg.Destinations.SplunkHEC.Token != ""
+}
diff --git a/cli/beacon/internal/endpoint/config/config_test.go b/cli/beacon/internal/endpoint/config/config_test.go
index 38e8dfe4..9977cab1 100644
--- a/cli/beacon/internal/endpoint/config/config_test.go
+++ b/cli/beacon/internal/endpoint/config/config_test.go
@@ -68,6 +68,55 @@ func TestSaveLoadRoundTrip(t *testing.T) {
}
}
+func TestSaveLoadSplunkHECRoundTripAndPrivatePermissions(t *testing.T) {
+ home := t.TempDir()
+ t.Setenv("HOME", home)
+ cfg := Default(true, filepath.Join(home, "logs", "runtime.jsonl"))
+ cfg.Destinations = &Destinations{SplunkHEC: &SplunkHEC{
+ Endpoint: "https://splunk.example:8088/services/collector",
+ Token: "hec-token",
+ Index: "beacon",
+ }}
+
+ path, err := Save(cfg)
+ if err != nil {
+ t.Fatalf("Save returned error: %v", err)
+ }
+ info, err := os.Stat(path)
+ if err != nil {
+ t.Fatalf("stat config: %v", err)
+ }
+ if got, want := info.Mode().Perm(), os.FileMode(0600); got != want {
+ t.Fatalf("config permissions = %o, want %o", got, want)
+ }
+
+ loaded, err := Load(true)
+ if err != nil {
+ t.Fatalf("Load returned error: %v", err)
+ }
+ splunk := loaded.Destinations.SplunkHEC
+ if !splunk.Enabled {
+ t.Fatal("SplunkHEC.Enabled = false, want true")
+ }
+ if splunk.Source != DefaultSplunkSource || splunk.Sourcetype != DefaultSplunkSourcetype {
+ t.Fatalf("Splunk defaults = source %q sourcetype %q", splunk.Source, splunk.Sourcetype)
+ }
+ if splunk.Token != "hec-token" || splunk.Index != "beacon" {
+ t.Fatalf("Splunk config did not round-trip: %#v", splunk)
+ }
+}
+
+func TestSaveRejectsIncompleteSplunkHEC(t *testing.T) {
+ home := t.TempDir()
+ t.Setenv("HOME", home)
+ cfg := Default(true, filepath.Join(home, "runtime.jsonl"))
+ cfg.Destinations = &Destinations{SplunkHEC: &SplunkHEC{Endpoint: "https://splunk.example:8088/services/collector"}}
+
+ if _, err := Save(cfg); err == nil {
+ t.Fatal("expected missing Splunk token error")
+ }
+}
+
func TestLoadDefaultsMissingContentRetentionToFull(t *testing.T) {
home := t.TempDir()
t.Setenv("HOME", home)
diff --git a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go b/cli/beacon/internal/endpoint/lifecycle/lifecycle.go
index 66dbd3a1..73f7765f 100644
--- a/cli/beacon/internal/endpoint/lifecycle/lifecycle.go
+++ b/cli/beacon/internal/endpoint/lifecycle/lifecycle.go
@@ -27,6 +27,7 @@ type InstallOptions struct {
CollectorPath string
StartService bool
ContentRetention endpointconfig.ContentRetention
+ SplunkHEC *endpointconfig.SplunkHEC
}
type UninstallOptions struct {
@@ -46,15 +47,28 @@ type InstallResult struct {
}
type Status struct {
- Version string `json:"version"`
- ConfigPath string `json:"config_path"`
- LogPath string `json:"log_path"`
- RuntimeLog RuntimeLogSource `json:"runtime_log"`
- Collector endpointcollector.Status `json:"collector"`
- Service service.Status `json:"service"`
- Harnesses []harness.Harness `json:"harnesses"`
- Diagnostics []diagnostics.Check `json:"diagnostics"`
- LastEvent string `json:"last_event,omitempty"`
+ Version string `json:"version"`
+ ConfigPath string `json:"config_path"`
+ LogPath string `json:"log_path"`
+ RuntimeLog RuntimeLogSource `json:"runtime_log"`
+ Collector endpointcollector.Status `json:"collector"`
+ Service service.Status `json:"service"`
+ Harnesses []harness.Harness `json:"harnesses"`
+ Diagnostics []diagnostics.Check `json:"diagnostics"`
+ LastEvent string `json:"last_event,omitempty"`
+ Destinations DestinationStatus `json:"destinations"`
+}
+
+type DestinationStatus struct {
+ SplunkHEC ConfiguredStatus `json:"splunk_hec"`
+}
+
+type ConfiguredStatus struct {
+ Configured bool `json:"configured"`
+ Endpoint string `json:"endpoint,omitempty"`
+ Index string `json:"index,omitempty"`
+ Source string `json:"source,omitempty"`
+ Sourcetype string `json:"sourcetype,omitempty"`
}
type RuntimeLogSource struct {
@@ -135,7 +149,7 @@ func Install(opts InstallOptions) (InstallResult, error) {
Harness: schema.HarnessInfo{Name: "endpoint"},
Message: "Beacon endpoint local telemetry configured",
})
- event.Destination = &schema.DestinationInfo{Type: "wazuh", Mode: "localfile", Status: "configured"}
+ event.Destination = installDestination(cfg)
if _, err := writer.AppendEvent(event, writer.Options{Path: cfg.LogPath, UserMode: cfg.UserMode}); err != nil {
return InstallResult{}, err
}
@@ -199,15 +213,16 @@ func GetStatus(userMode bool, logPath string) Status {
})
}
return Status{
- Version: version.GetVersion(),
- ConfigPath: endpointconfig.ConfigPath(effectiveCfg.UserMode),
- LogPath: effectiveCfg.LogPath,
- RuntimeLog: runtimeLog,
- Collector: endpointcollector.CheckStatus(effectiveCfg),
- Service: service.Manager{UserMode: effectiveCfg.UserMode}.Status(),
- Harnesses: harness.DiscoverAll(),
- Diagnostics: checks,
- LastEvent: last,
+ Version: version.GetVersion(),
+ ConfigPath: endpointconfig.ConfigPath(effectiveCfg.UserMode),
+ LogPath: effectiveCfg.LogPath,
+ RuntimeLog: runtimeLog,
+ Collector: endpointcollector.CheckStatus(effectiveCfg),
+ Service: service.Manager{UserMode: effectiveCfg.UserMode}.Status(),
+ Harnesses: harness.DiscoverAll(),
+ Diagnostics: checks,
+ LastEvent: last,
+ Destinations: destinationStatus(effectiveCfg),
}
}
@@ -267,9 +282,38 @@ func buildConfig(opts InstallOptions) endpointconfig.Config {
if opts.ContentRetention != "" {
cfg.ContentRetention = opts.ContentRetention
}
+ if opts.SplunkHEC != nil {
+ cfg.Destinations = &endpointconfig.Destinations{SplunkHEC: opts.SplunkHEC}
+ endpointconfig.NormalizeDestinations(&cfg)
+ }
return cfg
}
+func installDestination(cfg endpointconfig.Config) *schema.DestinationInfo {
+ destination := &schema.DestinationInfo{Type: "local_jsonl", Mode: "file", Status: "configured"}
+ if cfg.Destinations != nil && cfg.Destinations.SplunkHEC != nil && cfg.Destinations.SplunkHEC.Enabled {
+ destination.Type = "local_jsonl,splunk_hec"
+ destination.Mode = "file,hec"
+ }
+ return destination
+}
+
+func destinationStatus(cfg endpointconfig.Config) DestinationStatus {
+ status := DestinationStatus{}
+ if cfg.Destinations == nil || cfg.Destinations.SplunkHEC == nil || !cfg.Destinations.SplunkHEC.Enabled {
+ return status
+ }
+ splunk := cfg.Destinations.SplunkHEC
+ status.SplunkHEC = ConfiguredStatus{
+ Configured: true,
+ Endpoint: splunk.Endpoint,
+ Index: splunk.Index,
+ Source: splunk.Source,
+ Sourcetype: splunk.Sourcetype,
+ }
+ return status
+}
+
func loadOrDefault(userMode bool, logPath string) endpointconfig.Config {
if cfg, err := endpointconfig.Load(userMode); err == nil {
if logPath != "" {
@@ -287,6 +331,9 @@ func preflight(cfg endpointconfig.Config, startService bool) error {
if err := endpointconfig.ValidateContentRetention(cfg.ContentRetention); err != nil {
return err
}
+ if err := endpointconfig.ValidateDestinations(cfg.Destinations); err != nil {
+ return err
+ }
if runtime.GOOS != "darwin" {
return fmt.Errorf("production endpoint install is currently supported only on macOS")
}
diff --git a/cli/beacon/internal/endpoint/lifecycle/lifecycle_test.go b/cli/beacon/internal/endpoint/lifecycle/lifecycle_test.go
index 8d81d859..9076e733 100644
--- a/cli/beacon/internal/endpoint/lifecycle/lifecycle_test.go
+++ b/cli/beacon/internal/endpoint/lifecycle/lifecycle_test.go
@@ -41,6 +41,11 @@ func TestBuildConfigAppliesInstallOptions(t *testing.T) {
GRPCPort: 54317,
HTTPPort: 54318,
CollectorPath: collectorPath,
+ SplunkHEC: &endpointconfig.SplunkHEC{
+ Endpoint: "https://splunk.example:8088/services/collector",
+ Token: "hec-token",
+ Index: "beacon",
+ },
})
if !cfg.UserMode || cfg.LogPath != logPath {
@@ -55,6 +60,12 @@ func TestBuildConfigAppliesInstallOptions(t *testing.T) {
if cfg.Collector.BinaryPath != collectorPath {
t.Fatalf("BinaryPath = %q, want %q", cfg.Collector.BinaryPath, collectorPath)
}
+ if cfg.Destinations == nil || cfg.Destinations.SplunkHEC == nil || !cfg.Destinations.SplunkHEC.Enabled {
+ t.Fatalf("Splunk destination not configured: %#v", cfg.Destinations)
+ }
+ if got := cfg.Destinations.SplunkHEC.Source; got != endpointconfig.DefaultSplunkSource {
+ t.Fatalf("Splunk source = %q, want default", got)
+ }
}
func TestSelectRuntimeLogWarnsWhenSystemCollectorConflictsWithUserMode(t *testing.T) {
diff --git a/collector-builder/builder.yaml b/collector-builder/builder.yaml
index affc6b8b..3cfffca3 100644
--- a/collector-builder/builder.yaml
+++ b/collector-builder/builder.yaml
@@ -13,6 +13,7 @@ processors:
exporters:
- gomod: github.com/asymptote-labs/agent-beacon/collector-builder/exporter/beaconjsonexporter v0.0.0
path: ./exporter/beaconjsonexporter
+ - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/exporter/splunkhecexporter v0.121.0
extensions:
- gomod: github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension v0.121.0
diff --git a/packaging/macos/README.md b/packaging/macos/README.md
index bf35341d..593fcc7c 100644
--- a/packaging/macos/README.md
+++ b/packaging/macos/README.md
@@ -93,6 +93,13 @@ BEACON_OTLP_GRPC_PORT: default 4317
BEACON_OTLP_HTTP_PORT: default 4318
BEACON_COLLECTOR: default /opt/beacon/bin/beacon-otelcol when present
BEACON_NO_START: accepts 1/true/yes
+BEACON_SPLUNK_HEC_ENDPOINT: optional Splunk HEC URL
+BEACON_SPLUNK_HEC_TOKEN: optional Splunk HEC token
+BEACON_SPLUNK_INDEX: optional Splunk index
+BEACON_SPLUNK_SOURCE: optional Splunk source
+BEACON_SPLUNK_SOURCETYPE: optional Splunk sourcetype
+BEACON_SPLUNK_INSECURE_SKIP_VERIFY: accepts 1/true/yes
+BEACON_SPLUNK_CA_FILE: optional CA certificate path
```
Recommended rollout:
@@ -131,8 +138,18 @@ Parameter 6: OTLP gRPC port, default 4317
Parameter 7: OTLP HTTP port, default 4318
Parameter 8: collector path, default /opt/beacon/bin/beacon-otelcol
Parameter 9: no-start flag for install.sh only
+Parameter 10: Splunk HEC endpoint for install.sh only
+Parameter 11: Splunk HEC token for install.sh only
+Parameter 12: Splunk index for install.sh only
+Parameter 13: Splunk source for install.sh only
+Parameter 14: Splunk sourcetype for install.sh only
+Parameter 15: Splunk insecure TLS skip verify for install.sh only
+Parameter 16: Splunk CA file for install.sh only
```
+For repair policies, prefer the `BEACON_SPLUNK_*` environment variables so
+tokens do not need to be entered as visible script parameters.
+
Use `/opt/beacon/jamf/scripts/repair.sh` as a remediation policy for Macs where
Extension Attributes report a stale or unhealthy install. Use
`/opt/beacon/jamf/scripts/install-cursor-hooks.sh` as a separate user-context
@@ -148,6 +165,7 @@ Upload scripts from `packaging/macos/jamf/extension-attributes` to inventory:
- Content retention mode
- Configured harnesses
- Runtime log writability
+- Splunk HEC forwarding state
Suggested Smart Groups:
@@ -190,6 +208,13 @@ install.sh argument 3: OTLP gRPC port, default 4317
install.sh argument 4: OTLP HTTP port, default 4318
install.sh argument 5: collector path, default /opt/beacon/bin/beacon-otelcol
install.sh argument 6: no-start flag, accepts 1/true/yes
+install.sh argument 7: Splunk HEC endpoint
+install.sh argument 8: Splunk HEC token
+install.sh argument 9: Splunk index
+install.sh argument 10: Splunk source
+install.sh argument 11: Splunk sourcetype
+install.sh argument 12: Splunk insecure TLS skip verify
+install.sh argument 13: Splunk CA file
```
Fleet repair script positional arguments:
@@ -199,6 +224,13 @@ repair.sh argument 1: harnesses, default claude,codex
repair.sh argument 2: content retention, default full
repair.sh argument 3: OTLP gRPC port, default 4317
repair.sh argument 4: OTLP HTTP port, default 4318
+repair.sh argument 5: Splunk HEC endpoint
+repair.sh argument 6: Splunk HEC token
+repair.sh argument 7: Splunk index
+repair.sh argument 8: Splunk source
+repair.sh argument 9: Splunk sourcetype
+repair.sh argument 10: Splunk insecure TLS skip verify
+repair.sh argument 11: Splunk CA file
```
Add queries from `packaging/macos/fleet/queries` as Fleet policies or labels.
@@ -212,6 +244,7 @@ content retention, harness configuration, Wazuh validation, and launchd health.
- `content-retention.sql`
- `configured-harnesses.sql`
- `runtime-log-writable.sql`
+- `splunk-hec-forwarding.sql`
Recommended Fleet policies:
diff --git a/packaging/macos/fleet/queries/splunk-hec-forwarding.sql b/packaging/macos/fleet/queries/splunk-hec-forwarding.sql
new file mode 100644
index 00000000..092ace9c
--- /dev/null
+++ b/packaging/macos/fleet/queries/splunk-hec-forwarding.sql
@@ -0,0 +1,13 @@
+SELECT
+ CASE
+ WHEN NOT EXISTS (
+ SELECT 1
+ FROM file
+ WHERE path = '/Library/Application Support/Beacon/Endpoint/config.json'
+ ) THEN 'missing'
+ WHEN COUNT(*) > 0 THEN 'configured'
+ ELSE 'not_configured'
+ END AS splunk_hec_config_state
+FROM yara
+WHERE path = '/Library/Application Support/Beacon/Endpoint/config.json'
+ AND sigrule = 'rule splunk_hec_configured { strings: $dest = "\"splunk_hec\"" $endpoint = "\"endpoint\"" condition: all of them }';
diff --git a/packaging/macos/fleet/scripts/install.sh b/packaging/macos/fleet/scripts/install.sh
index 47b96e2c..12c26696 100755
--- a/packaging/macos/fleet/scripts/install.sh
+++ b/packaging/macos/fleet/scripts/install.sh
@@ -12,4 +12,11 @@ BEACON_OTLP_GRPC_PORT="${BEACON_OTLP_GRPC_PORT:-${3:-4317}}" \
BEACON_OTLP_HTTP_PORT="${BEACON_OTLP_HTTP_PORT:-${4:-4318}}" \
BEACON_COLLECTOR="$BEACON_COLLECTOR" \
BEACON_NO_START="${BEACON_NO_START:-${6:-0}}" \
+BEACON_SPLUNK_HEC_ENDPOINT="${BEACON_SPLUNK_HEC_ENDPOINT:-${7:-}}" \
+BEACON_SPLUNK_HEC_TOKEN="${BEACON_SPLUNK_HEC_TOKEN:-${8:-}}" \
+BEACON_SPLUNK_INDEX="${BEACON_SPLUNK_INDEX:-${9:-}}" \
+BEACON_SPLUNK_SOURCE="${BEACON_SPLUNK_SOURCE:-${10:-}}" \
+BEACON_SPLUNK_SOURCETYPE="${BEACON_SPLUNK_SOURCETYPE:-${11:-}}" \
+BEACON_SPLUNK_INSECURE_SKIP_VERIFY="${BEACON_SPLUNK_INSECURE_SKIP_VERIFY:-${12:-0}}" \
+BEACON_SPLUNK_CA_FILE="${BEACON_SPLUNK_CA_FILE:-${13:-}}" \
"$BEACON_INSTALL_SCRIPT"
diff --git a/packaging/macos/fleet/scripts/repair.sh b/packaging/macos/fleet/scripts/repair.sh
index 08de93c4..a311f728 100755
--- a/packaging/macos/fleet/scripts/repair.sh
+++ b/packaging/macos/fleet/scripts/repair.sh
@@ -7,10 +7,43 @@ BEACON_ENDPOINT_HARNESSES="${BEACON_ENDPOINT_HARNESSES:-${1:-claude,codex}}"
BEACON_CONTENT_RETENTION="${BEACON_CONTENT_RETENTION:-${2:-full}}"
BEACON_OTLP_GRPC_PORT="${BEACON_OTLP_GRPC_PORT:-${3:-4317}}"
BEACON_OTLP_HTTP_PORT="${BEACON_OTLP_HTTP_PORT:-${4:-4318}}"
+BEACON_SPLUNK_HEC_ENDPOINT="${BEACON_SPLUNK_HEC_ENDPOINT:-${5:-}}"
+BEACON_SPLUNK_HEC_TOKEN="${BEACON_SPLUNK_HEC_TOKEN:-${6:-}}"
+BEACON_SPLUNK_INDEX="${BEACON_SPLUNK_INDEX:-${7:-}}"
+BEACON_SPLUNK_SOURCE="${BEACON_SPLUNK_SOURCE:-${8:-}}"
+BEACON_SPLUNK_SOURCETYPE="${BEACON_SPLUNK_SOURCETYPE:-${9:-}}"
+BEACON_SPLUNK_INSECURE_SKIP_VERIFY="${BEACON_SPLUNK_INSECURE_SKIP_VERIFY:-${10:-0}}"
+BEACON_SPLUNK_CA_FILE="${BEACON_SPLUNK_CA_FILE:-${11:-}}"
-exec "$BEACON_BIN" endpoint repair \
+set -- endpoint repair \
--collector "$BEACON_COLLECTOR" \
--harness "$BEACON_ENDPOINT_HARNESSES" \
--content-retention "$BEACON_CONTENT_RETENTION" \
--otlp-grpc-port "$BEACON_OTLP_GRPC_PORT" \
--otlp-http-port "$BEACON_OTLP_HTTP_PORT"
+
+if [ -n "$BEACON_SPLUNK_HEC_ENDPOINT" ]; then
+ set -- "$@" --splunk-hec-endpoint "$BEACON_SPLUNK_HEC_ENDPOINT"
+fi
+if [ -n "$BEACON_SPLUNK_HEC_TOKEN" ]; then
+ set -- "$@" --splunk-hec-token "$BEACON_SPLUNK_HEC_TOKEN"
+fi
+if [ -n "$BEACON_SPLUNK_INDEX" ]; then
+ set -- "$@" --splunk-index "$BEACON_SPLUNK_INDEX"
+fi
+if [ -n "$BEACON_SPLUNK_SOURCE" ]; then
+ set -- "$@" --splunk-source "$BEACON_SPLUNK_SOURCE"
+fi
+if [ -n "$BEACON_SPLUNK_SOURCETYPE" ]; then
+ set -- "$@" --splunk-sourcetype "$BEACON_SPLUNK_SOURCETYPE"
+fi
+case "$BEACON_SPLUNK_INSECURE_SKIP_VERIFY" in
+ 1|true|TRUE|yes|YES)
+ set -- "$@" --splunk-insecure-skip-verify
+ ;;
+esac
+if [ -n "$BEACON_SPLUNK_CA_FILE" ]; then
+ set -- "$@" --splunk-ca-file "$BEACON_SPLUNK_CA_FILE"
+fi
+
+exec "$BEACON_BIN" "$@"
diff --git a/packaging/macos/install-endpoint.sh b/packaging/macos/install-endpoint.sh
index b1658445..e2f70e77 100755
--- a/packaging/macos/install-endpoint.sh
+++ b/packaging/macos/install-endpoint.sh
@@ -15,6 +15,13 @@ BEACON_OTLP_GRPC_PORT="${BEACON_OTLP_GRPC_PORT:-${6:-4317}}"
BEACON_OTLP_HTTP_PORT="${BEACON_OTLP_HTTP_PORT:-${7:-4318}}"
BEACON_COLLECTOR="${BEACON_COLLECTOR:-${8:-}}"
BEACON_NO_START="${BEACON_NO_START:-${9:-0}}"
+BEACON_SPLUNK_HEC_ENDPOINT="${BEACON_SPLUNK_HEC_ENDPOINT:-${10:-}}"
+BEACON_SPLUNK_HEC_TOKEN="${BEACON_SPLUNK_HEC_TOKEN:-${11:-}}"
+BEACON_SPLUNK_INDEX="${BEACON_SPLUNK_INDEX:-${12:-}}"
+BEACON_SPLUNK_SOURCE="${BEACON_SPLUNK_SOURCE:-${13:-}}"
+BEACON_SPLUNK_SOURCETYPE="${BEACON_SPLUNK_SOURCETYPE:-${14:-}}"
+BEACON_SPLUNK_INSECURE_SKIP_VERIFY="${BEACON_SPLUNK_INSECURE_SKIP_VERIFY:-${15:-0}}"
+BEACON_SPLUNK_CA_FILE="${BEACON_SPLUNK_CA_FILE:-${16:-}}"
if [ -z "$BEACON_COLLECTOR" ] && [ -x "/opt/beacon/bin/beacon-otelcol" ]; then
BEACON_COLLECTOR="/opt/beacon/bin/beacon-otelcol"
@@ -31,6 +38,30 @@ if [ -n "$BEACON_COLLECTOR" ]; then
set -- "$@" --collector "$BEACON_COLLECTOR"
fi
+if [ -n "$BEACON_SPLUNK_HEC_ENDPOINT" ]; then
+ set -- "$@" --splunk-hec-endpoint "$BEACON_SPLUNK_HEC_ENDPOINT"
+fi
+if [ -n "$BEACON_SPLUNK_HEC_TOKEN" ]; then
+ set -- "$@" --splunk-hec-token "$BEACON_SPLUNK_HEC_TOKEN"
+fi
+if [ -n "$BEACON_SPLUNK_INDEX" ]; then
+ set -- "$@" --splunk-index "$BEACON_SPLUNK_INDEX"
+fi
+if [ -n "$BEACON_SPLUNK_SOURCE" ]; then
+ set -- "$@" --splunk-source "$BEACON_SPLUNK_SOURCE"
+fi
+if [ -n "$BEACON_SPLUNK_SOURCETYPE" ]; then
+ set -- "$@" --splunk-sourcetype "$BEACON_SPLUNK_SOURCETYPE"
+fi
+case "$BEACON_SPLUNK_INSECURE_SKIP_VERIFY" in
+ 1|true|TRUE|yes|YES)
+ set -- "$@" --splunk-insecure-skip-verify
+ ;;
+esac
+if [ -n "$BEACON_SPLUNK_CA_FILE" ]; then
+ set -- "$@" --splunk-ca-file "$BEACON_SPLUNK_CA_FILE"
+fi
+
case "$BEACON_NO_START" in
1|true|TRUE|yes|YES)
set -- "$@" --no-start
diff --git a/packaging/macos/jamf/extension-attributes/splunk-hec-forwarding.sh b/packaging/macos/jamf/extension-attributes/splunk-hec-forwarding.sh
new file mode 100755
index 00000000..df475ad7
--- /dev/null
+++ b/packaging/macos/jamf/extension-attributes/splunk-hec-forwarding.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+set -eu
+
+CONFIG_PATH="${BEACON_ENDPOINT_CONFIG:-/Library/Application Support/Beacon/Endpoint/config.json}"
+
+if [ ! -f "$CONFIG_PATH" ]; then
+ echo "<result>missing</result>"
+ exit 0
+fi
+
+STATE="$(awk '
+ /"splunk_hec"[[:space:]]*:/ { in_splunk = 1 }
+ in_splunk && /"enabled"[[:space:]]*:[[:space:]]*true/ { enabled = 1 }
+ in_splunk && /"endpoint"[[:space:]]*:[[:space:]]*"/ { endpoint = 1 }
+ END {
+ if (enabled || endpoint) {
+ print "configured"
+ } else {
+ print "not_configured"
+ }
+ }
+' "$CONFIG_PATH")"
+
+echo "<result>$STATE</result>"
diff --git a/packaging/macos/jamf/scripts/repair.sh b/packaging/macos/jamf/scripts/repair.sh
index 63eaf545..fd018b3d 100755
--- a/packaging/macos/jamf/scripts/repair.sh
+++ b/packaging/macos/jamf/scripts/repair.sh
@@ -7,10 +7,43 @@ BEACON_ENDPOINT_HARNESSES="${BEACON_ENDPOINT_HARNESSES:-${4:-claude,codex}}"
BEACON_CONTENT_RETENTION="${BEACON_CONTENT_RETENTION:-${5:-full}}"
BEACON_OTLP_GRPC_PORT="${BEACON_OTLP_GRPC_PORT:-${6:-4317}}"
BEACON_OTLP_HTTP_PORT="${BEACON_OTLP_HTTP_PORT:-${7:-4318}}"
+BEACON_SPLUNK_HEC_ENDPOINT="${BEACON_SPLUNK_HEC_ENDPOINT:-${8:-}}"
+BEACON_SPLUNK_HEC_TOKEN="${BEACON_SPLUNK_HEC_TOKEN:-${9:-}}"
+BEACON_SPLUNK_INDEX="${BEACON_SPLUNK_INDEX:-${10:-}}"
+BEACON_SPLUNK_SOURCE="${BEACON_SPLUNK_SOURCE:-${11:-}}"
+BEACON_SPLUNK_SOURCETYPE="${BEACON_SPLUNK_SOURCETYPE:-${12:-}}"
+BEACON_SPLUNK_INSECURE_SKIP_VERIFY="${BEACON_SPLUNK_INSECURE_SKIP_VERIFY:-${13:-0}}"
+BEACON_SPLUNK_CA_FILE="${BEACON_SPLUNK_CA_FILE:-${14:-}}"
-exec "$BEACON_BIN" endpoint repair \
+set -- endpoint repair \
--collector "$BEACON_COLLECTOR" \
--harness "$BEACON_ENDPOINT_HARNESSES" \
--content-retention "$BEACON_CONTENT_RETENTION" \
--otlp-grpc-port "$BEACON_OTLP_GRPC_PORT" \
--otlp-http-port "$BEACON_OTLP_HTTP_PORT"
+
+if [ -n "$BEACON_SPLUNK_HEC_ENDPOINT" ]; then
+ set -- "$@" --splunk-hec-endpoint "$BEACON_SPLUNK_HEC_ENDPOINT"
+fi
+if [ -n "$BEACON_SPLUNK_HEC_TOKEN" ]; then
+ set -- "$@" --splunk-hec-token "$BEACON_SPLUNK_HEC_TOKEN"
+fi
+if [ -n "$BEACON_SPLUNK_INDEX" ]; then
+ set -- "$@" --splunk-index "$BEACON_SPLUNK_INDEX"
+fi
+if [ -n "$BEACON_SPLUNK_SOURCE" ]; then
+ set -- "$@" --splunk-source "$BEACON_SPLUNK_SOURCE"
+fi
+if [ -n "$BEACON_SPLUNK_SOURCETYPE" ]; then
+ set -- "$@" --splunk-sourcetype "$BEACON_SPLUNK_SOURCETYPE"
+fi
+case "$BEACON_SPLUNK_INSECURE_SKIP_VERIFY" in
+ 1|true|TRUE|yes|YES)
+ set -- "$@" --splunk-insecure-skip-verify
+ ;;
+esac
+if [ -n "$BEACON_SPLUNK_CA_FILE" ]; then
+ set -- "$@" --splunk-ca-file "$BEACON_SPLUNK_CA_FILE"
+fi
+
+exec "$BEACON_BIN" "$@"
diff --git a/packaging/macos/pkgbuild.md b/packaging/macos/pkgbuild.md
index 745942e3..49680073 100644
--- a/packaging/macos/pkgbuild.md
+++ b/packaging/macos/pkgbuild.md
@@ -91,8 +91,18 @@ Parameter 6: OTLP gRPC port, default 4317
Parameter 7: OTLP HTTP port, default 4318
Parameter 8: collector path, default /opt/beacon/bin/beacon-otelcol
Parameter 9: no-start flag for install.sh only
+Parameter 10: Splunk HEC endpoint for install.sh only
+Parameter 11: Splunk HEC token for install.sh only
+Parameter 12: Splunk index for install.sh only
+Parameter 13: Splunk source for install.sh only
+Parameter 14: Splunk sourcetype for install.sh only
+Parameter 15: Splunk insecure TLS skip verify for install.sh only
+Parameter 16: Splunk CA file for install.sh only
```
+For repair workflows, pass Splunk settings with `BEACON_SPLUNK_*` environment
+variables when possible so HEC tokens are not exposed as script parameters.
+
Upload Extension Attributes from
`packaging/macos/jamf/extension-attributes` and build Smart Groups for missing,
unhealthy, stale, or misconfigured endpoints. Scope `repair.sh` to those Smart
@@ -111,6 +121,15 @@ missing, unhealthy, stale, or misconfigured endpoints. Scope `repair.sh` to
hosts that fail the collector health, log freshness, retention, or log
writability policies.
+Splunk HEC forwarding can be configured with:
+
+```bash
+BEACON_SPLUNK_HEC_ENDPOINT="https://splunk.example:8088/services/collector" \
+BEACON_SPLUNK_HEC_TOKEN="$SPLUNK_HEC_TOKEN" \
+BEACON_SPLUNK_INDEX="beacon" \
+ /opt/beacon/scripts/install-endpoint.sh
+```
+
Release gates:
- `sh packaging/macos/test-endpoint-scripts.sh` passes
diff --git a/packaging/macos/scripts/postinstall b/packaging/macos/scripts/postinstall
index bf209500..415837f4 100755
--- a/packaging/macos/scripts/postinstall
+++ b/packaging/macos/scripts/postinstall
@@ -7,6 +7,13 @@ BEACON_ENDPOINT_HARNESSES="${BEACON_ENDPOINT_HARNESSES:-claude,codex}" \
BEACON_CONTENT_RETENTION="${BEACON_CONTENT_RETENTION:-full}" \
BEACON_OTLP_GRPC_PORT="${BEACON_OTLP_GRPC_PORT:-4317}" \
BEACON_OTLP_HTTP_PORT="${BEACON_OTLP_HTTP_PORT:-4318}" \
+BEACON_SPLUNK_HEC_ENDPOINT="${BEACON_SPLUNK_HEC_ENDPOINT:-}" \
+BEACON_SPLUNK_HEC_TOKEN="${BEACON_SPLUNK_HEC_TOKEN:-}" \
+BEACON_SPLUNK_INDEX="${BEACON_SPLUNK_INDEX:-}" \
+BEACON_SPLUNK_SOURCE="${BEACON_SPLUNK_SOURCE:-}" \
+BEACON_SPLUNK_SOURCETYPE="${BEACON_SPLUNK_SOURCETYPE:-}" \
+BEACON_SPLUNK_INSECURE_SKIP_VERIFY="${BEACON_SPLUNK_INSECURE_SKIP_VERIFY:-0}" \
+BEACON_SPLUNK_CA_FILE="${BEACON_SPLUNK_CA_FILE:-}" \
BEACON_NO_START=1 \
/opt/beacon/scripts/install-endpoint.sh
diff --git a/packaging/macos/test-endpoint-scripts.sh b/packaging/macos/test-endpoint-scripts.sh
index 2d7fa151..95491a66 100644
--- a/packaging/macos/test-endpoint-scripts.sh
+++ b/packaging/macos/test-endpoint-scripts.sh
@@ -30,12 +30,19 @@ BEACON_ENDPOINT_HARNESSES="claude,codex,cursor" \
BEACON_OTLP_GRPC_PORT="5317" \
BEACON_OTLP_HTTP_PORT="5318" \
BEACON_COLLECTOR="/tmp/beacon-otelcol" \
+BEACON_SPLUNK_HEC_ENDPOINT="https://splunk.example:8088/services/collector" \
+BEACON_SPLUNK_HEC_TOKEN="hec-token" \
+BEACON_SPLUNK_INDEX="beacon" \
+BEACON_SPLUNK_SOURCE="beacon-source" \
+BEACON_SPLUNK_SOURCETYPE="beacon:sourcetype" \
+BEACON_SPLUNK_INSECURE_SKIP_VERIFY="1" \
+BEACON_SPLUNK_CA_FILE="/tmp/splunk-ca.pem" \
STUB_LOG="$STUB_LOG" \
"$INSTALL_SCRIPT"
INSTALL_ARGS="$(cat "$STUB_LOG")"
case "$INSTALL_ARGS" in
- "endpoint install --system --harness claude,codex,cursor --content-retention full --otlp-grpc-port 5317 --otlp-http-port 5318 --collector /tmp/beacon-otelcol") ;;
+ "endpoint install --system --harness claude,codex,cursor --content-retention full --otlp-grpc-port 5317 --otlp-http-port 5318 --collector /tmp/beacon-otelcol --splunk-hec-endpoint https://splunk.example:8088/services/collector --splunk-hec-token hec-token --splunk-index beacon --splunk-source beacon-source --splunk-sourcetype beacon:sourcetype --splunk-insecure-skip-verify --splunk-ca-file /tmp/splunk-ca.pem") ;;
*)
echo "unexpected install args: $INSTALL_ARGS" >&2
exit 1
@@ -44,12 +51,14 @@ esac
BEACON_BIN="$STUB_BIN" \
BEACON_COLLECTOR="/tmp/beacon-otelcol" \
+BEACON_SPLUNK_HEC_ENDPOINT="https://splunk.example:8088/services/collector" \
+BEACON_SPLUNK_HEC_TOKEN="hec-token" \
STUB_LOG="$STUB_LOG" \
"$REPAIR_SCRIPT"
REPAIR_ARGS="$(cat "$STUB_LOG")"
case "$REPAIR_ARGS" in
- "endpoint repair --collector /tmp/beacon-otelcol --harness claude,codex --content-retention full --otlp-grpc-port 4317 --otlp-http-port 4318") ;;
+ "endpoint repair --collector /tmp/beacon-otelcol --harness claude,codex --content-retention full --otlp-grpc-port 4317 --otlp-http-port 4318 --splunk-hec-endpoint https://splunk.example:8088/services/collector --splunk-hec-token hec-token") ;;
*)
echo "unexpected repair args: $REPAIR_ARGS" >&2
exit 1
@@ -58,11 +67,11 @@ esac
BEACON_BIN="$STUB_BIN" \
STUB_LOG="$STUB_LOG" \
-"$INSTALL_SCRIPT" _ _ _ "claude" "metadata" "6317" "6318" "/tmp/jamf-otelcol" "1"
+"$INSTALL_SCRIPT" _ _ _ "claude" "metadata" "6317" "6318" "/tmp/jamf-otelcol" "1" "https://jamf-splunk.example:8088/services/collector" "jamf-token" "jamf-index" "jamf-source" "jamf:sourcetype" "true" "/tmp/jamf-ca.pem"
INSTALL_ARGS="$(cat "$STUB_LOG")"
case "$INSTALL_ARGS" in
- "endpoint install --system --harness claude --content-retention metadata --otlp-grpc-port 6317 --otlp-http-port 6318 --collector /tmp/jamf-otelcol --no-start") ;;
+ "endpoint install --system --harness claude --content-retention metadata --otlp-grpc-port 6317 --otlp-http-port 6318 --collector /tmp/jamf-otelcol --splunk-hec-endpoint https://jamf-splunk.example:8088/services/collector --splunk-hec-token jamf-token --splunk-index jamf-index --splunk-source jamf-source --splunk-sourcetype jamf:sourcetype --splunk-insecure-skip-verify --splunk-ca-file /tmp/jamf-ca.pem --no-start") ;;
*)
echo "unexpected Jamf positional install args: $INSTALL_ARGS" >&2
exit 1
@@ -100,11 +109,11 @@ esac
BEACON_BIN="$STUB_BIN" \
BEACON_INSTALL_SCRIPT="$INSTALL_SCRIPT" \
STUB_LOG="$STUB_LOG" \
-"$ROOT_DIR/packaging/macos/fleet/scripts/install.sh" "cursor" "redacted" "7317" "7318" "/tmp/fleet-otelcol" "1"
+"$ROOT_DIR/packaging/macos/fleet/scripts/install.sh" "cursor" "redacted" "7317" "7318" "/tmp/fleet-otelcol" "1" "https://fleet-splunk.example:8088/services/collector" "fleet-token" "fleet-index" "fleet-source" "fleet:sourcetype" "1" "/tmp/fleet-ca.pem"
INSTALL_ARGS="$(cat "$STUB_LOG")"
case "$INSTALL_ARGS" in
- "endpoint install --system --harness cursor --content-retention redacted --otlp-grpc-port 7317 --otlp-http-port 7318 --collector /tmp/fleet-otelcol --no-start") ;;
+ "endpoint install --system --harness cursor --content-retention redacted --otlp-grpc-port 7317 --otlp-http-port 7318 --collector /tmp/fleet-otelcol --splunk-hec-endpoint https://fleet-splunk.example:8088/services/collector --splunk-hec-token fleet-token --splunk-index fleet-index --splunk-source fleet-source --splunk-sourcetype fleet:sourcetype --splunk-insecure-skip-verify --splunk-ca-file /tmp/fleet-ca.pem --no-start") ;;
*)
echo "unexpected Fleet positional install args: $INSTALL_ARGS" >&2
exit 1
@@ -113,12 +122,15 @@ esac
BEACON_BIN="$STUB_BIN" \
BEACON_COLLECTOR="/tmp/beacon-otelcol" \
+BEACON_SPLUNK_HEC_ENDPOINT="https://splunk.example:8088/services/collector" \
+BEACON_SPLUNK_HEC_TOKEN="hec-token" \
+BEACON_SPLUNK_INDEX="beacon" \
STUB_LOG="$STUB_LOG" \
"$FLEET_REPAIR_SCRIPT" "claude,cursor" "metadata" "8317" "8318"
REPAIR_ARGS="$(cat "$STUB_LOG")"
case "$REPAIR_ARGS" in
- "endpoint repair --collector /tmp/beacon-otelcol --harness claude,cursor --content-retention metadata --otlp-grpc-port 8317 --otlp-http-port 8318") ;;
+ "endpoint repair --collector /tmp/beacon-otelcol --harness claude,cursor --content-retention metadata --otlp-grpc-port 8317 --otlp-http-port 8318 --splunk-hec-endpoint https://splunk.example:8088/services/collector --splunk-hec-token hec-token --splunk-index beacon") ;;
*)
echo "unexpected Fleet positional repair args: $REPAIR_ARGS" >&2
exit 1
@@ -148,7 +160,14 @@ cat >"$CONFIG_PATH" <<'JSON'
"claude",
"codex"
],
- "content_retention": "full"
+ "content_retention": "full",
+ "destinations": {
+ "splunk_hec": {
+ "enabled": true,
+ "endpoint": "https://splunk.example:8088/services/collector",
+ "token": "redacted"
+ }
+ }
}
JSON
@@ -170,6 +189,15 @@ case "$HARNESSES" in
;;
esac
+SPLUNK_STATE="$(BEACON_ENDPOINT_CONFIG="$CONFIG_PATH" "$ROOT_DIR/packaging/macos/jamf/extension-attributes/splunk-hec-forwarding.sh")"
+case "$SPLUNK_STATE" in
+ "<result>configured</result>") ;;
+ *)
+ echo "unexpected Splunk HEC extension attribute result: $SPLUNK_STATE" >&2
+ exit 1
+ ;;
+esac
+
BEACON_BIN="$STUB_BIN" \
STUB_LOG="$STUB_LOG" \
"$UNINSTALL_SCRIPT"