From 4dd7477627dc254048592bda34e064e57abd8c03 Mon Sep 17 00:00:00 2001 From: Denis Rechkunov Date: Wed, 15 Jan 2025 20:20:46 +0100 Subject: [PATCH] Fix Python tests --- filebeat/tests/files/config.yml | 26 ++++++++++++------- filebeat/tests/load/filebeat.yml | 12 ++++++--- .../tests/open-file-handlers/filebeat.yml | 22 +++++++++------- filebeat/tests/system/config/filebeat.yml.j2 | 1 + .../system/config/filebeat_inputs.yml.j2 | 1 + .../template-test-module/test/config/test.yml | 3 ++- .../system/module/test/test/config/test.yml | 3 ++- filebeat/tests/system/test_autodiscover.py | 3 ++- filebeat/tests/system/test_container.py | 3 +++ filebeat/tests/system/test_crawler.py | 2 ++ filebeat/tests/system/test_registrar.py | 2 ++ filebeat/tests/system/test_reload_inputs.py | 5 ++-- filebeat/tests/system/test_shutdown.py | 3 ++- 13 files changed, 56 insertions(+), 30 deletions(-) diff --git a/filebeat/tests/files/config.yml b/filebeat/tests/files/config.yml index 423a214e035c..3d282c60c771 100644 --- a/filebeat/tests/files/config.yml +++ b/filebeat/tests/files/config.yml @@ -1,26 +1,32 @@ filebeat: inputs: - - # Paths that should be crawled and fetched + - + # Paths that should be crawled and fetched paths: - /var/log/app*.log - /var/log/s*.log # Input: This must be either log or stdin - type: filestream + input: log + allow_deprecated_use: true # Optional additional fields fields: level: debug review: 1 - type: filestream + type: log ignore_older: 0 - close.on_state_change.inactive: 5m - prospector.scanner.check_interval: 10s - buffer_size: 5000 - - fields: + close_inactive: 5m + scan_frequency: 10s + harvester_buffer_size: 5000 + tail_files: false + - + fields: paths: - /var/log/test.log - type: filestream - - fields: - type: stdin + input: log + allow_deprecated_use: true + - + fields: + input: stdin # Paths is not required spool_size: 2048 idle_timeout: 5s diff --git a/filebeat/tests/load/filebeat.yml b/filebeat/tests/load/filebeat.yml index 3e62adc3b6ef..5616d6ff442b 100644 --- a/filebeat/tests/load/filebeat.yml +++ b/filebeat/tests/load/filebeat.yml @@ -1,6 +1,7 @@ filebeat: inputs: - - type: filestream + - type: log + allow_deprecated_use: true paths: - /Users/ruflin/Dev/gopath/src/github.com/elastic/filebeat/tests/load/logs/* @@ -8,9 +9,9 @@ filebeat: # level: debug # review: 1 ignore_older: 0 - close.on_state_change.inactive: 5m - prospector.scanner.check_interval: 0s - buffer_size: 1000000 + close_inactive: 5m + scan_frequency: 0s + harvester_buffer_size: 1000000 spool_size: 4096 idle_timeout: 5s @@ -22,6 +23,7 @@ filebeat: # Configure what outputs to use when sending the data collected by filebeat. # You can enable one or multiple outputs by setting enabled option to true. output: + ## File as output file: # Path to the directory where to save the generated files. The option is mandatory. @@ -30,6 +32,8 @@ output: rotate_every_kb: 10000 number_of_files: 100 + + logging: to_files: true #selectors: ["*"] diff --git a/filebeat/tests/open-file-handlers/filebeat.yml b/filebeat/tests/open-file-handlers/filebeat.yml index c23a486fb194..674dce056d48 100644 --- a/filebeat/tests/open-file-handlers/filebeat.yml +++ b/filebeat/tests/open-file-handlers/filebeat.yml @@ -1,19 +1,21 @@ filebeat.inputs: - # Reads logs generated by the generator containers - - type: filestream - paths: - - /logfiles/* - close.on_state_change.inactive: 1m - ignore_older: 2m - clean_inactive: 5m + +# Reads logs generated by the generator containers +- type: log + allow_deprecated_use: true + paths: + - /logfiles/* + close_inactive: 1m + ignore_older: 2m + clean_inactive: 5m # Reads docker container logs -#- type: filestream +#- type: log # paths: # - /var/lib/docker/containers/*/*-json.log -# Reads system logs -#- type: filestream +# Reads system logs +#- type: log # paths: # - /var/log/* # diff --git a/filebeat/tests/system/config/filebeat.yml.j2 b/filebeat/tests/system/config/filebeat.yml.j2 index f3b250c6b499..2497a6e46eea 100644 --- a/filebeat/tests/system/config/filebeat.yml.j2 +++ b/filebeat/tests/system/config/filebeat.yml.j2 @@ -6,6 +6,7 @@ filebeat.{{input_config | default("inputs")}}: {% endif %} {% if inputs %} - type: {{type | default("log") }} + allow_deprecated_use: true input_type: {{input_type_deprecated }} # Paths that should be crawled and fetched {% if path %}paths: diff --git a/filebeat/tests/system/config/filebeat_inputs.yml.j2 b/filebeat/tests/system/config/filebeat_inputs.yml.j2 index 9757f60023a2..c5c67fe244c9 100644 --- a/filebeat/tests/system/config/filebeat_inputs.yml.j2 +++ b/filebeat/tests/system/config/filebeat_inputs.yml.j2 @@ -3,6 +3,7 @@ filebeat.inputs: - paths: - {{input.path}} scan_frequency: 0.5s + allow_deprecated_use: true encoding: {{input.encoding | default("plain") }} {% endfor %} diff --git a/filebeat/tests/system/input/template-test-module/test/config/test.yml b/filebeat/tests/system/input/template-test-module/test/config/test.yml index 85c73e845d2c..f3d419e106c2 100644 --- a/filebeat/tests/system/input/template-test-module/test/config/test.yml +++ b/filebeat/tests/system/input/template-test-module/test/config/test.yml @@ -1,4 +1,5 @@ -type: filestream +type: log +allow_deprecated_use: true paths: {{ range $i, $path := .paths }} - {{$path}} diff --git a/filebeat/tests/system/module/test/test/config/test.yml b/filebeat/tests/system/module/test/test/config/test.yml index a235ae30f3e8..cde1d43e14b5 100644 --- a/filebeat/tests/system/module/test/test/config/test.yml +++ b/filebeat/tests/system/module/test/test/config/test.yml @@ -1,4 +1,5 @@ -type: filestream +type: log +allow_deprecated_use: true paths: {{ range $i, $path := .paths }} - {{$path}} diff --git a/filebeat/tests/system/test_autodiscover.py b/filebeat/tests/system/test_autodiscover.py index 558835dd46bf..8eb78d5504c4 100644 --- a/filebeat/tests/system/test_autodiscover.py +++ b/filebeat/tests/system/test_autodiscover.py @@ -29,6 +29,7 @@ def test_docker(self): equals.docker.container.name: {container.name} config: - type: filestream + id: ${data.container.name} paths: - %s/${{data.docker.container.name}}.log ''' % self.working_dir, @@ -58,7 +59,7 @@ def test_default_settings(self): 'hints.enabled': 'true', 'hints.default_config': ''' type: filestream - id: ${data.container.name}-${data.container.id} + id: ${data.container.name} paths: - %s/${data.container.name}.log ''' % self.working_dir, diff --git a/filebeat/tests/system/test_container.py b/filebeat/tests/system/test_container.py index 067eabd19772..8a57137fc33f 100644 --- a/filebeat/tests/system/test_container.py +++ b/filebeat/tests/system/test_container.py @@ -14,6 +14,7 @@ def test_container_input(self): """ input_raw = """ - type: container + allow_deprecated_use: true paths: - {}/logs/*.log """ @@ -44,6 +45,7 @@ def test_container_input_cri(self): """ input_raw = """ - type: container + allow_deprecated_use: true paths: - {}/logs/*.log """ @@ -74,6 +76,7 @@ def test_container_input_registry_for_unparsable_lines(self): """ input_raw = """ - type: container + allow_deprecated_use: true paths: - {}/logs/*.log """ diff --git a/filebeat/tests/system/test_crawler.py b/filebeat/tests/system/test_crawler.py index 39f0d4541240..a0df166ced09 100644 --- a/filebeat/tests/system/test_crawler.py +++ b/filebeat/tests/system/test_crawler.py @@ -585,6 +585,8 @@ def test_encodings(self): inputs = [] for enc_go, enc_py, _ in encodings: inputs.append({ + "type": "log", + "allow_deprecated_use": True, "path": self.working_dir + "/log/test-{}".format(enc_py), "encoding": enc_go }) diff --git a/filebeat/tests/system/test_registrar.py b/filebeat/tests/system/test_registrar.py index b08eda2777cb..7c272901adc8 100644 --- a/filebeat/tests/system/test_registrar.py +++ b/filebeat/tests/system/test_registrar.py @@ -1352,9 +1352,11 @@ def test_registrar_meta(self): self.render_config_template( type='container', input_raw=''' + allow_deprecated_use: true paths: {path} stream: stdout - type: container + allow_deprecated_use: true paths: {path} stream: stderr '''.format(path=os.path.abspath(self.working_dir) + "/log/*/*.log") diff --git a/filebeat/tests/system/test_reload_inputs.py b/filebeat/tests/system/test_reload_inputs.py index 824dcae35f6f..fd8e917c76d4 100644 --- a/filebeat/tests/system/test_reload_inputs.py +++ b/filebeat/tests/system/test_reload_inputs.py @@ -5,10 +5,11 @@ inputConfigTemplate = """ -- type: filestream +- type: log + allow_deprecated_use: true paths: - {} - prospector.scanner.check_interval: 1s + scan_frequency: 1s """ diff --git a/filebeat/tests/system/test_shutdown.py b/filebeat/tests/system/test_shutdown.py index 97fd25c61a32..0ef25b3a9e08 100644 --- a/filebeat/tests/system/test_shutdown.py +++ b/filebeat/tests/system/test_shutdown.py @@ -176,7 +176,8 @@ def test_stopping_empty_path(self): """ input_raw = """ -- type: filestream +- type: log + allow_deprecated_use: true paths: [] """