diff --git a/x-pack/elastic-agent/pkg/agent/program/program_test.go b/x-pack/elastic-agent/pkg/agent/program/program_test.go index 5ca35de01362..04c3519af65d 100644 --- a/x-pack/elastic-agent/pkg/agent/program/program_test.go +++ b/x-pack/elastic-agent/pkg/agent/program/program_test.go @@ -5,6 +5,7 @@ package program import ( + "flag" "io/ioutil" "os" "path/filepath" @@ -21,6 +22,10 @@ import ( "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/agent/transpiler" ) +var ( + generateFlag = flag.Bool("generate", false, "Write golden files") +) + func TestGroupBy(t *testing.T) { t.Run("only named output", func(t *testing.T) { sConfig := map[string]interface{}{ @@ -490,6 +495,81 @@ func TestConfiguration(t *testing.T) { } } +func TestUseCases(t *testing.T) { + defer os.Remove("fleet.yml") + + useCasesPath := filepath.Join("testdata", "usecases") + useCases, err := filepath.Glob(filepath.Join(useCasesPath, "*.yml")) + require.NoError(t, err) + + generatedFilesDir := filepath.Join(useCasesPath, "generated") + + // Cleanup all generated files to make sure not having any left overs + if *generateFlag { + err := os.RemoveAll(generatedFilesDir) + require.NoError(t, err) + } + + for _, usecase := range useCases { + t.Run(usecase, func(t *testing.T) { + + useCaseName := strings.TrimSuffix(filepath.Base(usecase), ".yml") + singleConfig, err := ioutil.ReadFile(usecase) + require.NoError(t, err) + + var m map[string]interface{} + err = yaml.Unmarshal(singleConfig, &m) + require.NoError(t, err) + + ast, err := transpiler.NewAST(m) + require.NoError(t, err) + + programs, err := Programs(&fakeAgentInfo{}, ast) + require.NoError(t, err) + + require.Equal(t, 1, len(programs)) + + defPrograms, ok := programs["default"] + require.True(t, ok) + + for _, program := range defPrograms { + generatedPath := filepath.Join( + useCasesPath, "generated", + useCaseName+"."+strings.ToLower(program.Spec.Cmd)+".golden.yml", + ) + + compareMap := &transpiler.MapVisitor{} + program.Config.Accept(compareMap) + + // Generate new golden file for programm + if *generateFlag { + d, err := yaml.Marshal(&compareMap.Content) + require.NoError(t, err) + + err = os.MkdirAll(generatedFilesDir, 0755) + require.NoError(t, err) + err = ioutil.WriteFile(generatedPath, d, 0644) + require.NoError(t, err) + } + + programConfig, err := ioutil.ReadFile(generatedPath) + require.NoError(t, err) + + var m map[string]interface{} + err = yamltest.FromYAML(programConfig, &m) + require.NoError(t, errors.Wrap(err, program.Cmd())) + + if !assert.True(t, cmp.Equal(m, compareMap.Content)) { + diff := cmp.Diff(m, compareMap.Content) + if diff != "" { + t.Errorf("%s-%s mismatch (-want +got):\n%s", usecase, program.Spec.Name, diff) + } + } + } + }) + } +} + type fakeAgentInfo struct{} func (*fakeAgentInfo) AgentID() string { diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/enabled_output_true.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/enabled_output_true.yml new file mode 100644 index 000000000000..9601388c536d --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/enabled_output_true.yml @@ -0,0 +1,17 @@ +inputs: + - type: event/file + streams: + - paths: + - /var/log/hello1.log + - /var/log/hello2.log +management: + host: "localhost" +config: + reload: 123 +outputs: + default: + type: elasticsearch + enabled: true + hosts: [127.0.0.1:9200, 127.0.0.1:9300] + username: elastic + password: changeme diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/enabled_true.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/enabled_true.yml new file mode 100644 index 000000000000..6afc7f37ab15 --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/enabled_true.yml @@ -0,0 +1,22 @@ +name: Production Website DB Servers +fleet: + kibana_url: https://kibana.mydomain.com:5601 + ca_hash: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y= + checkin_interval: 5m +inputs: + - type: event/file + streams: + - enabled: true + paths: + - /var/log/hello1.log + - /var/log/hello2.log +management: + host: "localhost" +config: + reload: 123 +outputs: + default: + type: elasticsearch + hosts: [127.0.0.1:9200, 127.0.0.1:9300] + username: elastic + password: changeme diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/endpoint_basic.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/endpoint_basic.yml new file mode 100644 index 000000000000..9f438cd46fdc --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/endpoint_basic.yml @@ -0,0 +1,115 @@ +revision: 5 +name: Endpoint Host +fleet: + access_api_key: VuaCfGcBCdbkQm-e5aOx:ui2lp2axTNmsyakw9tvNnw + protocol: https + hosts: [ localhost:5601 ] + timeout: 30s + agent: + id: fleet-agent-id + logging.level: error + host: + id: host-agent-id + +outputs: + default: + type: elasticsearch + hosts: [127.0.0.1:9200, 127.0.0.1:9300] + username: elastic + password: changeme + api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA + ca_sha256: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y= + +inputs: +- id: endpoint-id + type: endpoint + name: endpoint-1 + enabled: true + package: + name: endpoint + version: 0.3.0 + data_stream: + namespace: default + artifact_manifest: + schema_version: v22 + manifest_version: v21 + artifacts: + - endpoint-allowlist-windows: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-windows + - endpoint-allowlist-macos: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-macos + - endpoint-allowlist-linux: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-linux + policy: + linux: + advanced: + free-form: free-form-value + indices: + network: logs-endpoint.events.network-default + file: logs-endpoint.events.file-default + process: logs-endpoint.events.process-default + metadata: metrics-endpoint.metadata-default + policy: metrics-endpoint.policy-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + events: + process: true + file: true + network: true + windows: + malware: + mode: prevent + advanced: + free-form: free-form-value + indices: + network: logs-endpoint.events.network-default + file: logs-endpoint.events.file-default + registry: logs-endpoint.events.registry-default + process: logs-endpoint.events.process-default + driver: logs-endpoint.events.driver-default + library: logs-endpoint.events.library-default + alerts: logs-endpoint.alerts-default + metadata: metrics-endpoint.metadata-default + policy: metrics-endpoint.policy-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + events: + registry: true + process: true + security: true + file: true + dns: false + dll_and_driver_load: false + network: true + mac: + malware: + mode: prevent + advanced: + free-form: free-form-value + indices: + network: logs-endpoint.events.network-default + file: logs-endpoint.events.file-default + process: logs-endpoint.events.process-default + alerts: logs-endpoint.alerts-default + metadata: metrics-endpoint.metadata-default + policy: metrics-endpoint.policy-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + events: + process: true + file: true + network: true +runtime: + arch: x86_64 diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/fleet_server.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/fleet_server.yml new file mode 100644 index 000000000000..a816197917e7 --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/fleet_server.yml @@ -0,0 +1,51 @@ +name: Fleet Server Only +fleet: + enabled: true + access_api_key: VuaCfGcBCdbkQm-e5aOx:ui2lp2axTNmsyakw9tvNnw + protocol: https + hosts: [ localhost:5601 ] + timeout: 30s + agent: + id: fleet-agent-id + logging.level: error + host: + id: host-agent-id + server: + host: 127.0.0.1 + port: 8822 + ssl: + verification_mode: none + policy: + id: copy-policy-id + output: + elasticsearch: + hosts: [ 127.0.0.1:9200, 127.0.0.1:9300 ] + username: fleet + password: fleetpassword + +outputs: + default: + type: elasticsearch + hosts: [127.0.0.1:9200, 127.0.0.1:9300] + username: elastic + password: changeme + api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA + ca_sha256: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y= + +inputs: + - id: fleet-server-id + type: fleet-server + use_output: default + data_stream: + namespace: default + name: fleet_server-1 + revision: 6 + server: + host: 0.0.0.0 + port: 8220 + limits: + max_connections: 40 + runtime: + gc_percent: 50 + timeouts: + read: 5m diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/enabled_output_true.filebeat.golden.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/enabled_output_true.filebeat.golden.yml new file mode 100644 index 000000000000..6b898a6128a3 --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/enabled_output_true.filebeat.golden.yml @@ -0,0 +1,38 @@ +filebeat: + inputs: + - index: logs-generic-default + paths: + - /var/log/hello1.log + - /var/log/hello2.log + processors: + - add_fields: + fields: + dataset: generic + namespace: default + type: logs + target: data_stream + - add_fields: + fields: + dataset: generic + target: event + - add_fields: + fields: + id: agent-id + snapshot: false + version: 8.0.0 + target: elastic_agent + - add_fields: + fields: + id: agent-id + target: agent + type: log +output: + elasticsearch: + enabled: true + headers: + h1: test-header + hosts: + - 127.0.0.1:9200 + - 127.0.0.1:9300 + password: changeme + username: elastic diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/enabled_true.filebeat.golden.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/enabled_true.filebeat.golden.yml new file mode 100644 index 000000000000..197bf2f62321 --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/enabled_true.filebeat.golden.yml @@ -0,0 +1,38 @@ +filebeat: + inputs: + - enabled: true + index: logs-generic-default + paths: + - /var/log/hello1.log + - /var/log/hello2.log + processors: + - add_fields: + fields: + dataset: generic + namespace: default + type: logs + target: data_stream + - add_fields: + fields: + dataset: generic + target: event + - add_fields: + fields: + id: agent-id + snapshot: false + version: 8.0.0 + target: elastic_agent + - add_fields: + fields: + id: agent-id + target: agent + type: log +output: + elasticsearch: + headers: + h1: test-header + hosts: + - 127.0.0.1:9200 + - 127.0.0.1:9300 + password: changeme + username: elastic diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/endpoint_basic.endpoint-security.golden.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/endpoint_basic.endpoint-security.golden.yml new file mode 100644 index 000000000000..6359f9185b8d --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/endpoint_basic.endpoint-security.golden.yml @@ -0,0 +1,112 @@ +fleet: + access_api_key: VuaCfGcBCdbkQm-e5aOx:ui2lp2axTNmsyakw9tvNnw + agent: + id: fleet-agent-id + logging.level: error + host: + id: host-agent-id + hosts: + - localhost:5601 + protocol: https + timeout: 30s +inputs: +- artifact_manifest: + artifacts: + - endpoint-allowlist-windows: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-windows + - endpoint-allowlist-macos: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-macos + - endpoint-allowlist-linux: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-linux + manifest_version: v21 + schema_version: v22 + data_stream: + namespace: default + enabled: true + id: endpoint-id + name: endpoint-1 + package: + name: endpoint + version: 0.3.0 + policy: + linux: + advanced: + free-form: free-form-value + events: + file: true + network: true + process: true + indices: + file: logs-endpoint.events.file-default + metadata: metrics-endpoint.metadata-default + network: logs-endpoint.events.network-default + policy: metrics-endpoint.policy-default + process: logs-endpoint.events.process-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + mac: + advanced: + free-form: free-form-value + events: + file: true + network: true + process: true + indices: + alerts: logs-endpoint.alerts-default + file: logs-endpoint.events.file-default + metadata: metrics-endpoint.metadata-default + network: logs-endpoint.events.network-default + policy: metrics-endpoint.policy-default + process: logs-endpoint.events.process-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + malware: + mode: prevent + windows: + advanced: + free-form: free-form-value + events: + dll_and_driver_load: false + dns: false + file: true + network: true + process: true + registry: true + security: true + indices: + alerts: logs-endpoint.alerts-default + driver: logs-endpoint.events.driver-default + file: logs-endpoint.events.file-default + library: logs-endpoint.events.library-default + metadata: metrics-endpoint.metadata-default + network: logs-endpoint.events.network-default + policy: metrics-endpoint.policy-default + process: logs-endpoint.events.process-default + registry: logs-endpoint.events.registry-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + malware: + mode: prevent + type: endpoint +output: + elasticsearch: + api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA + ca_sha256: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y= + hosts: + - 127.0.0.1:9200 + - 127.0.0.1:9300 + password: changeme + username: elastic +revision: 5 diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/fleet_server.fleet-server.golden.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/fleet_server.fleet-server.golden.yml new file mode 100644 index 000000000000..01dc3bd3c89c --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/fleet_server.fleet-server.golden.yml @@ -0,0 +1,33 @@ +fleet: + agent: + id: fleet-agent-id + logging.level: error + host: + id: host-agent-id +inputs: +- id: fleet-server-id + name: fleet_server-1 + policy: + id: copy-policy-id + revision: 6 + server: + host: 0.0.0.0 + limits: + max_connections: 40 + port: 8220 + runtime: + gc_percent: 50 + ssl: + verification_mode: none + timeouts: + read: 5m + type: fleet-server +output: + elasticsearch: + headers: + h1: test-header + hosts: + - 127.0.0.1:9200 + - 127.0.0.1:9300 + password: fleetpassword + username: fleet diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/namespace.endpoint-security.golden.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/namespace.endpoint-security.golden.yml new file mode 100644 index 000000000000..7c8b033c4e62 --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/namespace.endpoint-security.golden.yml @@ -0,0 +1,113 @@ +fleet: + access_api_key: VuaCfGcBCdbkQm-e5aOx:ui2lp2axTNmsyakw9tvNnw + agent: + id: fleet-agent-id + logging.level: error + enabled: true + host: + id: host-agent-id + hosts: + - localhost:5601 + protocol: https + timeout: 30s +inputs: +- artifact_manifest: + artifacts: + - endpoint-allowlist-windows: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-windows + - endpoint-allowlist-macos: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-macos + - endpoint-allowlist-linux: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-linux + manifest_version: v21 + schema_version: v22 + data_stream: + namespace: default + enabled: true + id: endpoint-id + name: endpoint-1 + package: + name: endpoint + version: 0.3.0 + policy: + linux: + advanced: + free-form: free-form-value + events: + file: true + network: true + process: true + indices: + file: logs-endpoint.events.file-default + metadata: metrics-endpoint.metadata-default + network: logs-endpoint.events.network-default + policy: metrics-endpoint.policy-default + process: logs-endpoint.events.process-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + mac: + advanced: + free-form: free-form-value + events: + file: true + network: true + process: true + indices: + alerts: logs-endpoint.alerts-default + file: logs-endpoint.events.file-default + metadata: metrics-endpoint.metadata-default + network: logs-endpoint.events.network-default + policy: metrics-endpoint.policy-default + process: logs-endpoint.events.process-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + malware: + mode: prevent + windows: + advanced: + free-form: free-form-value + events: + dll_and_driver_load: false + dns: false + file: true + network: true + process: true + registry: true + security: true + indices: + alerts: logs-endpoint.alerts-default + driver: logs-endpoint.events.driver-default + file: logs-endpoint.events.file-default + library: logs-endpoint.events.library-default + metadata: metrics-endpoint.metadata-default + network: logs-endpoint.events.network-default + policy: metrics-endpoint.policy-default + process: logs-endpoint.events.process-default + registry: logs-endpoint.events.registry-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + malware: + mode: prevent + type: endpoint +output: + elasticsearch: + api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA + ca_sha256: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y= + hosts: + - 127.0.0.1:9200 + - 127.0.0.1:9300 + namespace: test_namespace + password: changeme + username: elastic diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/namespace.filebeat.golden.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/namespace.filebeat.golden.yml new file mode 100644 index 000000000000..2def5f274dea --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/namespace.filebeat.golden.yml @@ -0,0 +1,70 @@ +filebeat: + inputs: + - index: logs-generic-default + paths: + - /var/log/hello1.log + - /var/log/hello2.log + processors: + - add_fields: + fields: + dataset: generic + namespace: default + type: logs + target: data_stream + - add_fields: + fields: + dataset: generic + target: event + - add_fields: + fields: + id: agent-id + snapshot: false + version: 8.0.0 + target: elastic_agent + - add_fields: + fields: + id: agent-id + target: agent + type: log + vars: + var: value + - index: testtype-generic-default + paths: + - /var/log/hello3.log + - /var/log/hello4.log + processors: + - add_fields: + fields: + dataset: generic + namespace: default + type: testtype + target: data_stream + - add_fields: + fields: + dataset: generic + target: event + - add_fields: + fields: + id: agent-id + snapshot: false + version: 8.0.0 + target: elastic_agent + - add_fields: + fields: + id: agent-id + target: agent + type: log + vars: + var: value +output: + elasticsearch: + api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA + ca_sha256: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y= + headers: + h1: test-header + hosts: + - 127.0.0.1:9200 + - 127.0.0.1:9300 + namespace: test_namespace + password: changeme + username: elastic diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/namespace.fleet-server.golden.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/namespace.fleet-server.golden.yml new file mode 100644 index 000000000000..ab7499a4f112 --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/namespace.fleet-server.golden.yml @@ -0,0 +1,18 @@ +fleet: + agent: + id: fleet-agent-id + logging.level: error + host: + id: host-agent-id +inputs: +- id: fleet-server-id + type: fleet-server +output: + elasticsearch: + headers: + h1: test-header + hosts: + - 127.0.0.1:9200 + - 127.0.0.1:9300 + password: fleetpassword + username: fleet diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/namespace.heartbeat.golden.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/namespace.heartbeat.golden.yml new file mode 100644 index 000000000000..c18573ee7803 --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/namespace.heartbeat.golden.yml @@ -0,0 +1,30 @@ +inputs: +- data_stream.namespace: default + host: http://localhost:80/service/status + id: unique-http-id + name: my-http + processors: + - add_fields: + fields: + id: agent-id + snapshot: false + version: 8.0.0 + target: elastic_agent + - add_fields: + fields: + id: agent-id + target: agent + schedule: '*/5 * * * * * *' + timeout: 16s + type: synthetics/http + wait: 1s +output: + elasticsearch: + api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA + ca_sha256: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y= + hosts: + - 127.0.0.1:9200 + - 127.0.0.1:9300 + namespace: test_namespace + password: changeme + username: elastic diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/namespace.metricbeat.golden.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/namespace.metricbeat.golden.yml new file mode 100644 index 000000000000..3232297227a0 --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/namespace.metricbeat.golden.yml @@ -0,0 +1,98 @@ +metricbeat: + modules: + - hosts: + - http://127.0.0.1:8080 + index: metrics-docker.status-default + metricsets: + - status + module: docker + processors: + - add_fields: + fields: + dataset: docker.status + namespace: default + type: metrics + target: data_stream + - add_fields: + fields: + dataset: docker.status + target: event + - add_fields: + fields: + id: agent-id + snapshot: false + version: 8.0.0 + target: elastic_agent + - add_fields: + fields: + id: agent-id + target: agent + - hosts: + - http://127.0.0.1:8080 + index: metrics-generic-default + metricsets: + - info + module: docker + processors: + - add_fields: + fields: + dataset: generic + namespace: default + type: metrics + target: data_stream + - add_fields: + fields: + dataset: generic + target: event + - add_fields: + fields: + id: agent-id + snapshot: false + version: 8.0.0 + target: elastic_agent + - add_fields: + fields: + id: agent-id + target: agent + - hosts: + - http://apache.remote + index: metrics-generic-testing + metricsets: + - info + module: apache + processors: + - add_fields: + fields: + should_be: first + - add_fields: + fields: + dataset: generic + namespace: testing + type: metrics + target: data_stream + - add_fields: + fields: + dataset: generic + target: event + - add_fields: + fields: + id: agent-id + snapshot: false + version: 8.0.0 + target: elastic_agent + - add_fields: + fields: + id: agent-id + target: agent +output: + elasticsearch: + api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA + ca_sha256: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y= + headers: + h1: test-header + hosts: + - 127.0.0.1:9200 + - 127.0.0.1:9300 + namespace: test_namespace + password: changeme + username: elastic diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/namespace.packetbeat.golden.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/namespace.packetbeat.golden.yml new file mode 100644 index 000000000000..cc38887ff8e2 --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/namespace.packetbeat.golden.yml @@ -0,0 +1,35 @@ +inputs: +- processors: + - add_fields: + fields: + id: agent-id + snapshot: false + version: 8.0.0 + target: elastic_agent + - add_fields: + fields: + id: agent-id + target: agent + streams: + - data_stream: + dataset: packet.flow + type: logs + keep_null: false + period: 10s + timeout: 10s + type: flow + - data_stream: + dataset: packet.icmp + type: logs + type: icmp + type: packet +output: + elasticsearch: + api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA + ca_sha256: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y= + hosts: + - 127.0.0.1:9200 + - 127.0.0.1:9300 + namespace: test_namespace + password: changeme + username: elastic diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/single_config.endpoint-security.golden.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/single_config.endpoint-security.golden.yml new file mode 100644 index 000000000000..552e169bbac2 --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/single_config.endpoint-security.golden.yml @@ -0,0 +1,114 @@ +fleet: + access_api_key: VuaCfGcBCdbkQm-e5aOx:ui2lp2axTNmsyakw9tvNnw + agent: + id: fleet-agent-id + logging.level: error + enabled: true + host: + id: host-agent-id + hosts: + - localhost:5601 + protocol: https + timeout: 30s +inputs: +- artifact_manifest: + artifacts: + - endpoint-allowlist-windows: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-windows + - endpoint-allowlist-macos: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-macos + - endpoint-allowlist-linux: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-linux + manifest_version: v21 + schema_version: v22 + data_stream: + namespace: default + enabled: true + id: endpoint-id + name: endpoint-1 + package: + name: endpoint + version: 0.3.0 + policy: + linux: + advanced: + free-form: free-form-value + events: + file: true + network: true + process: true + indices: + file: logs-endpoint.events.file-default + metadata: metrics-endpoint.metadata-default + network: logs-endpoint.events.network-default + policy: metrics-endpoint.policy-default + process: logs-endpoint.events.process-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + mac: + advanced: + free-form: free-form-value + events: + file: true + network: true + process: true + indices: + alerts: logs-endpoint.alerts-default + file: logs-endpoint.events.file-default + metadata: metrics-endpoint.metadata-default + network: logs-endpoint.events.network-default + policy: metrics-endpoint.policy-default + process: logs-endpoint.events.process-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + malware: + mode: prevent + windows: + advanced: + free-form: free-form-value + events: + dll_and_driver_load: false + dns: false + file: true + network: true + process: true + registry: true + security: true + indices: + alerts: logs-endpoint.alerts-default + driver: logs-endpoint.events.driver-default + file: logs-endpoint.events.file-default + library: logs-endpoint.events.library-default + metadata: metrics-endpoint.metadata-default + network: logs-endpoint.events.network-default + policy: metrics-endpoint.policy-default + process: logs-endpoint.events.process-default + registry: logs-endpoint.events.registry-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + malware: + mode: prevent + type: endpoint +output: + elasticsearch: + api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA + bulk_max_size: 23 + ca_sha256: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y= + hosts: + - 127.0.0.1:9200 + - 127.0.0.1:9300 + password: changeme + username: elastic + worker: 10 diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/single_config.filebeat.golden.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/single_config.filebeat.golden.yml new file mode 100644 index 000000000000..da16ff8200d9 --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/single_config.filebeat.golden.yml @@ -0,0 +1,71 @@ +filebeat: + inputs: + - index: logs-generic-default + paths: + - /var/log/hello1.log + - /var/log/hello2.log + processors: + - add_fields: + fields: + dataset: generic + namespace: default + type: logs + target: data_stream + - add_fields: + fields: + dataset: generic + target: event + - add_fields: + fields: + id: agent-id + snapshot: false + version: 8.0.0 + target: elastic_agent + - add_fields: + fields: + id: agent-id + target: agent + type: log + vars: + var: value + - index: testtype-generic-default + paths: + - /var/log/hello3.log + - /var/log/hello4.log + processors: + - add_fields: + fields: + dataset: generic + namespace: default + type: testtype + target: data_stream + - add_fields: + fields: + dataset: generic + target: event + - add_fields: + fields: + id: agent-id + snapshot: false + version: 8.0.0 + target: elastic_agent + - add_fields: + fields: + id: agent-id + target: agent + type: log + vars: + var: value +output: + elasticsearch: + api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA + bulk_max_size: 23 + ca_sha256: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y= + headers: + h1: test-header + hosts: + - 127.0.0.1:9200 + - 127.0.0.1:9300 + password: changeme + username: elastic + worker: 10 diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/single_config.fleet-server.golden.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/single_config.fleet-server.golden.yml new file mode 100644 index 000000000000..ab7499a4f112 --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/single_config.fleet-server.golden.yml @@ -0,0 +1,18 @@ +fleet: + agent: + id: fleet-agent-id + logging.level: error + host: + id: host-agent-id +inputs: +- id: fleet-server-id + type: fleet-server +output: + elasticsearch: + headers: + h1: test-header + hosts: + - 127.0.0.1:9200 + - 127.0.0.1:9300 + password: fleetpassword + username: fleet diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/single_config.heartbeat.golden.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/single_config.heartbeat.golden.yml new file mode 100644 index 000000000000..f4c5827603a8 --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/single_config.heartbeat.golden.yml @@ -0,0 +1,31 @@ +inputs: +- data_stream.namespace: default + host: http://localhost:80/service/status + id: unique-http-id + name: my-http + processors: + - add_fields: + fields: + id: agent-id + snapshot: false + version: 8.0.0 + target: elastic_agent + - add_fields: + fields: + id: agent-id + target: agent + schedule: '*/5 * * * * * *' + timeout: 16s + type: synthetics/http + wait: 1s +output: + elasticsearch: + api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA + bulk_max_size: 23 + ca_sha256: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y= + hosts: + - 127.0.0.1:9200 + - 127.0.0.1:9300 + password: changeme + username: elastic + worker: 10 diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/single_config.metricbeat.golden.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/single_config.metricbeat.golden.yml new file mode 100644 index 000000000000..aca140556350 --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/single_config.metricbeat.golden.yml @@ -0,0 +1,99 @@ +metricbeat: + modules: + - hosts: + - http://127.0.0.1:8080 + index: metrics-docker.status-default + metricsets: + - status + module: docker + processors: + - add_fields: + fields: + dataset: docker.status + namespace: default + type: metrics + target: data_stream + - add_fields: + fields: + dataset: docker.status + target: event + - add_fields: + fields: + id: agent-id + snapshot: false + version: 8.0.0 + target: elastic_agent + - add_fields: + fields: + id: agent-id + target: agent + - hosts: + - http://127.0.0.1:8080 + index: metrics-generic-default + metricsets: + - info + module: docker + processors: + - add_fields: + fields: + dataset: generic + namespace: default + type: metrics + target: data_stream + - add_fields: + fields: + dataset: generic + target: event + - add_fields: + fields: + id: agent-id + snapshot: false + version: 8.0.0 + target: elastic_agent + - add_fields: + fields: + id: agent-id + target: agent + - hosts: + - http://apache.remote + index: metrics-generic-testing + metricsets: + - info + module: apache + processors: + - add_fields: + fields: + should_be: first + - add_fields: + fields: + dataset: generic + namespace: testing + type: metrics + target: data_stream + - add_fields: + fields: + dataset: generic + target: event + - add_fields: + fields: + id: agent-id + snapshot: false + version: 8.0.0 + target: elastic_agent + - add_fields: + fields: + id: agent-id + target: agent +output: + elasticsearch: + api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA + bulk_max_size: 23 + ca_sha256: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y= + headers: + h1: test-header + hosts: + - 127.0.0.1:9200 + - 127.0.0.1:9300 + password: changeme + username: elastic + worker: 10 diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/single_config.packetbeat.golden.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/single_config.packetbeat.golden.yml new file mode 100644 index 000000000000..e7f13deb0a20 --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/single_config.packetbeat.golden.yml @@ -0,0 +1,36 @@ +inputs: +- processors: + - add_fields: + fields: + id: agent-id + snapshot: false + version: 8.0.0 + target: elastic_agent + - add_fields: + fields: + id: agent-id + target: agent + streams: + - data_stream: + dataset: packet.flow + type: logs + keep_null: false + period: 10s + timeout: 10s + type: flow + - data_stream: + dataset: packet.icmp + type: logs + type: icmp + type: packet +output: + elasticsearch: + api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA + bulk_max_size: 23 + ca_sha256: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y= + hosts: + - 127.0.0.1:9200 + - 127.0.0.1:9300 + password: changeme + username: elastic + worker: 10 diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/synthetics_config.heartbeat.golden.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/synthetics_config.heartbeat.golden.yml new file mode 100644 index 000000000000..870a0070f4eb --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/generated/synthetics_config.heartbeat.golden.yml @@ -0,0 +1,68 @@ +inputs: +- data_stream.namespace: default + host: http://localhost:80/service/status + id: unique-http-id + name: my-http + processors: + - add_fields: + fields: + id: agent-id + snapshot: false + version: 8.0.0 + target: elastic_agent + - add_fields: + fields: + id: agent-id + target: agent + schedule: '*/5 * * * * * *' + timeout: 16s + type: synthetics/http + wait: 1s +- data_stream.namespace: default + host: localhost:777 + id: unique-tcp-id + name: my-tcp + processors: + - add_fields: + fields: + id: agent-id + snapshot: false + version: 8.0.0 + target: elastic_agent + - add_fields: + fields: + id: agent-id + target: agent + schedule: '*/5 * * * * * *' + timeout: 16s + type: synthetics/tcp + wait: 1s +- data_stream.namespace: default + host: localhost + id: unique-icmp-id + ipv4: true + ipv6: true + mode: any + name: my-icmp + processors: + - add_fields: + fields: + id: agent-id + snapshot: false + version: 8.0.0 + target: elastic_agent + - add_fields: + fields: + id: agent-id + target: agent + schedule: '@every 5s' + timeout: 16s + type: synthetics/icmp + wait: 1s +output: + elasticsearch: + hosts: + - 127.0.0.1:9200 + - 127.0.0.1:9300 + password: changeme + username: elastic diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/namespace.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/namespace.yml new file mode 100644 index 000000000000..c2f83a9abf08 --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/namespace.yml @@ -0,0 +1,201 @@ +name: Production Website DB Servers +fleet: + enabled: true + access_api_key: VuaCfGcBCdbkQm-e5aOx:ui2lp2axTNmsyakw9tvNnw + protocol: https + hosts: [ localhost:5601 ] + timeout: 30s + agent: + id: fleet-agent-id + logging.level: error + host: + id: host-agent-id + server: + output: + elasticsearch: + hosts: [ 127.0.0.1:9200, 127.0.0.1:9300 ] + username: fleet + password: fleetpassword + +outputs: + default: + type: elasticsearch + namespace: test_namespace + hosts: [127.0.0.1:9200, 127.0.0.1:9300] + username: elastic + password: changeme + api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA + ca_sha256: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y= + + monitoring: + type: elasticsearch + api_key: VuaCfGcBCdbkQm-e5aOx:ui2lp2axTNmsyakw9tvNnw + hosts: ["monitoring:9200"] + ca_sha256: "7lHLiyp4J8m9kw38SJ7SURJP4bXRZv/BNxyyXkCcE/M=" + +inputs: +- id: fleet-server-id + type: fleet-server + use_output: default + data_stream: + type: default +- type: docker/metrics + use_output: default + streams: + - metricset: status + processors: + - null + data_stream: + dataset: docker.status + - metricset: info + data_stream: + dataset: "" + hosts: ["http://127.0.0.1:8080"] +- type: logfile + use_output: default + streams: + - paths: + - /var/log/hello1.log + - /var/log/hello2.log + vars: + var: value +- type: logfile + data_stream: + type: testtype + use_output: default + streams: + - paths: + - /var/log/hello3.log + - /var/log/hello4.log + vars: + var: value +- id: apache-metrics-id + type: apache/metrics + data_stream: + namespace: testing + use_output: default + processors: + - add_fields: + fields: + should_be: first + streams: + - enabled: true + metricset: info + hosts: ["http://apache.remote"] + hosts: ["http://apache.local"] +- type: synthetics/http + id: unique-http-id + name: my-http + schedule: '*/5 * * * * * *' + host: "http://localhost:80/service/status" + timeout: 16s + wait: 1s +- type: packet + streams: + - type: flow + timeout: 10s + period: 10s + keep_null: false + data_stream: + dataset: packet.flow + type: logs + - type: icmp + data_stream: + dataset: packet.icmp + type: logs +- id: endpoint-id + type: endpoint + name: endpoint-1 + enabled: true + package: + name: endpoint + version: 0.3.0 + data_stream: + namespace: default + artifact_manifest: + schema_version: v22 + manifest_version: v21 + artifacts: + - endpoint-allowlist-windows: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-windows + - endpoint-allowlist-macos: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-macos + - endpoint-allowlist-linux: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-linux + policy: + linux: + advanced: + free-form: free-form-value + indices: + network: logs-endpoint.events.network-default + file: logs-endpoint.events.file-default + process: logs-endpoint.events.process-default + metadata: metrics-endpoint.metadata-default + policy: metrics-endpoint.policy-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + events: + process: true + file: true + network: true + windows: + malware: + mode: prevent + advanced: + free-form: free-form-value + indices: + network: logs-endpoint.events.network-default + file: logs-endpoint.events.file-default + registry: logs-endpoint.events.registry-default + process: logs-endpoint.events.process-default + driver: logs-endpoint.events.driver-default + library: logs-endpoint.events.library-default + alerts: logs-endpoint.alerts-default + metadata: metrics-endpoint.metadata-default + policy: metrics-endpoint.policy-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + events: + registry: true + process: true + security: true + file: true + dns: false + dll_and_driver_load: false + network: true + mac: + malware: + mode: prevent + advanced: + free-form: free-form-value + indices: + network: logs-endpoint.events.network-default + file: logs-endpoint.events.file-default + process: logs-endpoint.events.process-default + alerts: logs-endpoint.alerts-default + metadata: metrics-endpoint.metadata-default + policy: metrics-endpoint.policy-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + events: + process: true + file: true + network: true + +agent.monitoring: + use_output: monitoring + +agent: + reload: 123 diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/single_config.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/single_config.yml new file mode 100644 index 000000000000..16a03f9a77da --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/single_config.yml @@ -0,0 +1,202 @@ +name: Production Website DB Servers +fleet: + enabled: true + access_api_key: VuaCfGcBCdbkQm-e5aOx:ui2lp2axTNmsyakw9tvNnw + protocol: https + hosts: [ localhost:5601 ] + timeout: 30s + agent: + id: fleet-agent-id + logging.level: error + host: + id: host-agent-id + server: + output: + elasticsearch: + hosts: [ 127.0.0.1:9200, 127.0.0.1:9300 ] + username: fleet + password: fleetpassword + +outputs: + default: + type: elasticsearch + hosts: [127.0.0.1:9200, 127.0.0.1:9300] + bulk_max_size: 23 + worker: 10 + username: elastic + password: changeme + api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA + ca_sha256: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y= + + monitoring: + type: elasticsearch + api_key: VuaCfGcBCdbkQm-e5aOx:ui2lp2axTNmsyakw9tvNnw + hosts: ["monitoring:9200"] + ca_sha256: "7lHLiyp4J8m9kw38SJ7SURJP4bXRZv/BNxyyXkCcE/M=" + +inputs: +- id: fleet-server-id + type: fleet-server + use_output: default + data_stream: + type: default +- type: docker/metrics + use_output: default + streams: + - metricset: status + processors: + - null + data_stream: + dataset: docker.status + - metricset: info + data_stream: + dataset: "" + hosts: ["http://127.0.0.1:8080"] +- type: logfile + use_output: default + streams: + - paths: + - /var/log/hello1.log + - /var/log/hello2.log + vars: + var: value +- type: logfile + data_stream: + type: testtype + use_output: default + streams: + - paths: + - /var/log/hello3.log + - /var/log/hello4.log + vars: + var: value +- id: apache-metrics-id + type: apache/metrics + data_stream: + namespace: testing + use_output: default + processors: + - add_fields: + fields: + should_be: first + streams: + - enabled: true + metricset: info + hosts: ["http://apache.remote"] + hosts: ["http://apache.local"] +- type: synthetics/http + id: unique-http-id + name: my-http + schedule: '*/5 * * * * * *' + host: "http://localhost:80/service/status" + timeout: 16s + wait: 1s +- type: packet + streams: + - type: flow + timeout: 10s + period: 10s + keep_null: false + data_stream: + dataset: packet.flow + type: logs + - type: icmp + data_stream: + dataset: packet.icmp + type: logs +- id: endpoint-id + type: endpoint + name: endpoint-1 + enabled: true + package: + name: endpoint + version: 0.3.0 + data_stream: + namespace: default + artifact_manifest: + schema_version: v22 + manifest_version: v21 + artifacts: + - endpoint-allowlist-windows: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-windows + - endpoint-allowlist-macos: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-macos + - endpoint-allowlist-linux: + sha256: 1234 + size: 2 + url: /relative/path/to/endpoint-allowlist-linux + policy: + linux: + advanced: + free-form: free-form-value + indices: + network: logs-endpoint.events.network-default + file: logs-endpoint.events.file-default + process: logs-endpoint.events.process-default + metadata: metrics-endpoint.metadata-default + policy: metrics-endpoint.policy-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + events: + process: true + file: true + network: true + windows: + malware: + mode: prevent + advanced: + free-form: free-form-value + indices: + network: logs-endpoint.events.network-default + file: logs-endpoint.events.file-default + registry: logs-endpoint.events.registry-default + process: logs-endpoint.events.process-default + driver: logs-endpoint.events.driver-default + library: logs-endpoint.events.library-default + alerts: logs-endpoint.alerts-default + metadata: metrics-endpoint.metadata-default + policy: metrics-endpoint.policy-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + events: + registry: true + process: true + security: true + file: true + dns: false + dll_and_driver_load: false + network: true + mac: + malware: + mode: prevent + advanced: + free-form: free-form-value + indices: + network: logs-endpoint.events.network-default + file: logs-endpoint.events.file-default + process: logs-endpoint.events.process-default + alerts: logs-endpoint.alerts-default + metadata: metrics-endpoint.metadata-default + policy: metrics-endpoint.policy-default + telemetry: metrics-endpoint.telemetry-default + logging: + file: info + stdout: debug + events: + process: true + file: true + network: true + +agent.monitoring: + use_output: monitoring + +agent: + reload: 123 diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/synthetics_config.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/synthetics_config.yml new file mode 100644 index 000000000000..74aa9916a658 --- /dev/null +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/usecases/synthetics_config.yml @@ -0,0 +1,31 @@ +inputs: +- type: synthetics/http + id: unique-http-id + name: my-http + schedule: '*/5 * * * * * *' + host: "http://localhost:80/service/status" + timeout: 16s + wait: 1s +- type: synthetics/tcp + id: unique-tcp-id + name: my-tcp + schedule: '*/5 * * * * * *' + host: "localhost:777" + timeout: 16s + wait: 1s +- type: synthetics/icmp + id: unique-icmp-id + name: my-icmp + schedule: '@every 5s' + host: "localhost" + ipv4: true + ipv6: true + mode: any + timeout: 16s + wait: 1s +outputs: + default: + type: elasticsearch + hosts: [127.0.0.1:9200, 127.0.0.1:9300] + username: elastic + password: changeme