Skip to content

Commit

Permalink
unit
Browse files Browse the repository at this point in the history
  • Loading branch information
michalpristas committed Jun 25, 2021
1 parent 0c0b48c commit 11ebaab
Show file tree
Hide file tree
Showing 8 changed files with 556 additions and 0 deletions.
4 changes: 4 additions & 0 deletions x-pack/elastic-agent/pkg/agent/program/program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,10 @@ func TestConfiguration(t *testing.T) {
empty bool
err bool
}{
"namespace": {
programs: []string{"filebeat", "fleet-server", "heartbeat", "metricbeat", "endpoint", "packetbeat"},
expected: 6,
},
"single_config": {
programs: []string{"filebeat", "fleet-server", "heartbeat", "metricbeat", "endpoint", "packetbeat"},
expected: 6,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
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

output:
elasticsearch:
hosts:
- "127.0.0.1:9200"
- "127.0.0.1:9300"
namespace: test_namespace
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
filebeat:
inputs:
- type: log
paths:
- /var/log/hello1.log
- /var/log/hello2.log
index: logs-generic-default
vars:
var: value
processors:
- add_fields:
target: "data_stream"
fields:
type: logs
dataset: generic
namespace: default
- add_fields:
target: "event"
fields:
dataset: generic
- add_fields:
target: "elastic_agent"
fields:
id: agent-id
version: 8.0.0
snapshot: false
- add_fields:
target: "agent"
fields:
id: agent-id
- type: log
paths:
- /var/log/hello3.log
- /var/log/hello4.log
index: testtype-generic-default
vars:
var: value
processors:
- add_fields:
target: "data_stream"
fields:
type: testtype
dataset: generic
namespace: default
- add_fields:
target: "event"
fields:
dataset: generic
- add_fields:
target: "elastic_agent"
fields:
id: agent-id
version: 8.0.0
snapshot: false
- add_fields:
target: "agent"
fields:
id: agent-id
output:
elasticsearch:
hosts:
- 127.0.0.1:9200
- 127.0.0.1:9300
namespace: test_namespace
username: elastic
password: changeme
api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA
ca_sha256: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y=
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
fleet:
agent:
id: fleet-agent-id
logging.level: error
host:
id: host-agent-id

output:
elasticsearch:
hosts: [ 127.0.0.1:9200, 127.0.0.1:9300 ]
username: fleet
password: fleetpassword

inputs:
- id: fleet-server-id
type: fleet-server
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
inputs:
- type: synthetics/http
id: unique-http-id
name: my-http
schedule: '*/5 * * * * * *'
host: "http://localhost:80/service/status"
timeout: 16s
wait: 1s
data_stream.namespace: default
processors:
- add_fields:
target: 'elastic_agent'
fields:
id: agent-id
version: 8.0.0
snapshot: false
- add_fields:
target: 'agent'
fields:
id: agent-id
output:
elasticsearch:
hosts:
- 127.0.0.1:9200
- 127.0.0.1:9300
namespace: test_namespace
username: elastic
password: changeme
api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA
ca_sha256: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y=
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
metricbeat:
modules:
- module: docker
metricsets: [status]
index: metrics-docker.status-default
hosts: ["http://127.0.0.1:8080"]
processors:
- add_fields:
target: "data_stream"
fields:
type: metrics
dataset: docker.status
namespace: default
- add_fields:
target: "event"
fields:
dataset: docker.status
- add_fields:
target: "elastic_agent"
fields:
id: agent-id
version: 8.0.0
snapshot: false
- add_fields:
target: "agent"
fields:
id: agent-id
- module: docker
metricsets: [info]
index: metrics-generic-default
hosts: ["http://127.0.0.1:8080"]
processors:
- add_fields:
target: "data_stream"
fields:
type: metrics
dataset: generic
namespace: default
- add_fields:
target: "event"
fields:
dataset: generic
- add_fields:
target: "elastic_agent"
fields:
id: agent-id
version: 8.0.0
snapshot: false
- add_fields:
target: "agent"
fields:
id: agent-id
- module: apache
metricsets: [info]
index: metrics-generic-testing
hosts: ["http://apache.remote"]
processors:
- add_fields:
fields:
should_be: first
- add_fields:
target: "data_stream"
fields:
type: metrics
dataset: generic
namespace: testing
- add_fields:
target: "event"
fields:
dataset: generic
- add_fields:
target: "elastic_agent"
fields:
id: agent-id
version: 8.0.0
snapshot: false
- add_fields:
target: "agent"
fields:
id: agent-id
output:
elasticsearch:
hosts: [127.0.0.1:9200, 127.0.0.1:9300]
namespace: test_namespace
username: elastic
password: changeme
api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA
ca_sha256: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y=
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
inputs:
- type: packet
processors:
- add_fields:
target: 'elastic_agent'
fields:
id: agent-id
version: 8.0.0
snapshot: false
- add_fields:
target: 'agent'
fields:
id: agent-id
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
output:
elasticsearch:
hosts:
- 127.0.0.1:9200
- 127.0.0.1:9300
namespace: test_namespace
username: elastic
password: changeme
api_key: TiNAGG4BaaMdaH1tRfuU:KnR6yE41RrSowb0kQ0HWoA
ca_sha256: 7HIpactkIAq2Y49orFOOQKurWxmmSFZhBCoQYcRhJ3Y=
Loading

0 comments on commit 11ebaab

Please sign in to comment.