Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate test_configuration (1/2) of test_logcollector documentation to qa-docs #2163

Merged
merged 5 commits into from
Jan 27, 2022

Conversation

mdengra
Copy link
Contributor

@mdengra mdengra commented Nov 3, 2021

Related issue
#1813

Description

As part of epic #1796, this PR adds the missing documentation and migrates the current documentation to the new format used by qa-docs.
The schema used is the one defined in issue #1694

New tags

The following tags are added to the wiki: logcollector_configuration

Generated documentation

test_basic_configuration_age.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The 'wazuh-logcollector' daemon monitors configured files and commands for new log messages. Specifically, these tests will check if the logcollector detects invalid values for the 'age' tag and the Wazuh API returns the same values for the configured 'localfile' section. Log data collection is the real-time process of making sense out of the records generated by servers or devices. This component can receive logs through text files or Windows event logs. It can also directly receive logs via remote syslog which is useful for firewalls and other such devices.",
    "tier": 0,
    "modules": [
        "logcollector"
    ],
    "components": [
        "agent",
        "manager"
    ],
    "daemons": [
        "wazuh-logcollector",
        "wazuh-apid"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2019",
        "Windows Server 2016",
        "Windows Server 2012",
        "Windows Server 2003",
        "Windows XP"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html",
        "https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#age"
    ],
    "tags": [
        "logcollector_configuration"
    ],
    "name": "test_basic_configuration_age.py",
    "id": 1,
    "group_id": 0,
    "tests": [
        {
            "description": "Check if the 'wazuh-logcollector' daemon detects invalid configurations for the 'age' tag. For this purpose, the test will set a 'localfile' section using valid/invalid values for that tag. Then, it will check if the 'analyzing' event is triggered when using a valid value, or if an error event is generated when using an invalid one. Finally, the test will verify that the Wazuh API returns the same values for the 'localfile' section that the configured one.",
            "wazuh_min_version": "4.2.0",
            "parameters": [
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                }
            ],
            "assertions": [
                "Verify that the logcollector generates error events when using invalid values for the 'age' tag.",
                "Verify that the logcollector generates 'analyzing' events when using valid values for the 'age' tag.",
                "Verify that the Wazuh API returns the same values for the 'localfile' section as the configured one."
            ],
            "input_description": "A configuration template (test_basic_configuration_age) is contained in an external YAML file (wazuh_basic_configuration.yaml). That template is combined with different test cases defined in the module. Those include configuration settings for the 'wazuh-logcollector' daemon.",
            "expected_output": [
                "r'Analyzing file.*'",
                "r'Invalid .* for localfile'",
                "r'Configuration error at .*'"
            ],
            "tags": [
                "invalid_settings"
            ],
            "name": "test_configuration_age",
            "inputs": [
                "/tmp/testing.txt_syslog_3s",
                "/tmp/testing.txt_syslog_4000s",
                "/tmp/testing.txt_syslog_5m",
                "/tmp/testing.txt_syslog_99h",
                "/tmp/testing.txt_syslog_94201d",
                "/tmp/testing.txt_syslog_44sTesting",
                "/tmp/testing.txt_syslog_Testing44s",
                "/tmp/testing.txt_syslog_9hTesting",
                "/tmp/testing.txt_syslog_400mTesting",
                "/tmp/testing.txt_syslog_3992",
                "/tmp/testing.txt_syslog_Testing"
            ]
        }
    ]
}

test_basic_configuration_age.yaml

brief: The 'wazuh-logcollector' daemon monitors configured files and commands for
  new log messages. Specifically, these tests will check if the logcollector detects
  invalid values for the 'age' tag and the Wazuh API returns the same values for the
  configured 'localfile' section. Log data collection is the real-time process of
  making sense out of the records generated by servers or devices. This component
  can receive logs through text files or Windows event logs. It can also directly
  receive logs via remote syslog which is useful for firewalls and other such devices.
components:
- agent
- manager
copyright: 'Copyright (C) 2015-2021, Wazuh Inc.

  Created by Wazuh, Inc. <[email protected]>.

  This program is free software; you can redistribute it and/or modify it under the
  terms of GPLv2'
daemons:
- wazuh-logcollector
- wazuh-apid
group_id: 0
id: 1
modules:
- logcollector
name: test_basic_configuration_age.py
os_platform:
- linux
- windows
os_version:
- Arch Linux
- Amazon Linux 2
- Amazon Linux 1
- CentOS 8
- CentOS 7
- CentOS 6
- Ubuntu Focal
- Ubuntu Bionic
- Ubuntu Xenial
- Ubuntu Trusty
- Debian Buster
- Debian Stretch
- Debian Jessie
- Debian Wheezy
- Red Hat 8
- Red Hat 7
- Red Hat 6
- Windows 10
- Windows 8
- Windows 7
- Windows Server 2019
- Windows Server 2016
- Windows Server 2012
- Windows Server 2003
- Windows XP
references:
- https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html
- https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#age
tags:
- logcollector_configuration
tests:
- assertions:
  - Verify that the logcollector generates error events when using invalid values
    for the 'age' tag.
  - Verify that the logcollector generates 'analyzing' events when using valid values
    for the 'age' tag.
  - Verify that the Wazuh API returns the same values for the 'localfile' section
    as the configured one.
  description: Check if the 'wazuh-logcollector' daemon detects invalid configurations
    for the 'age' tag. For this purpose, the test will set a 'localfile' section using
    valid/invalid values for that tag. Then, it will check if the 'analyzing' event
    is triggered when using a valid value, or if an error event is generated when
    using an invalid one. Finally, the test will verify that the Wazuh API returns
    the same values for the 'localfile' section that the configured one.
  expected_output:
  - r'Analyzing file.*'
  - r'Invalid .* for localfile'
  - r'Configuration error at .*'
  input_description: A configuration template (test_basic_configuration_age) is contained
    in an external YAML file (wazuh_basic_configuration.yaml). That template is combined
    with different test cases defined in the module. Those include configuration settings
    for the 'wazuh-logcollector' daemon.
  inputs:
  - /tmp/testing.txt_syslog_3s
  - /tmp/testing.txt_syslog_4000s
  - /tmp/testing.txt_syslog_5m
  - /tmp/testing.txt_syslog_99h
  - /tmp/testing.txt_syslog_94201d
  - /tmp/testing.txt_syslog_44sTesting
  - /tmp/testing.txt_syslog_Testing44s
  - /tmp/testing.txt_syslog_9hTesting
  - /tmp/testing.txt_syslog_400mTesting
  - /tmp/testing.txt_syslog_3992
  - /tmp/testing.txt_syslog_Testing
  name: test_configuration_age
  parameters:
  - get_configuration:
      brief: Get configurations from the module.
      type: fixture
  - configure_environment:
      brief: Configure a custom environment for testing.
      type: fixture
  tags:
  - invalid_settings
  wazuh_min_version: 4.2.0
tier: 0
type: integration

 

test_basic_configuration_alias.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The 'wazuh-logcollector' daemon monitors configured files and commands for new log messages. Specifically, these tests will check if the log collector generates events using the alias specified in the 'alias' tag when monitoring a command, and the Wazuh API returns the same values for the configured 'localfile' section. Log data collection is the real-time process of making sense out of the records generated by servers or devices. This component can receive logs through text files or Windows event logs. It can also directly receive logs via remote syslog which is useful for firewalls and other such devices.",
    "tier": 0,
    "modules": [
        "logcollector"
    ],
    "components": [
        "agent",
        "manager"
    ],
    "daemons": [
        "wazuh-logcollector",
        "wazuh-apid"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2019",
        "Windows Server 2016",
        "Windows Server 2012",
        "Windows Server 2003",
        "Windows XP"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html",
        "https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#alias"
    ],
    "tags": [
        "logcollector_configuration"
    ],
    "name": "test_basic_configuration_alias.py",
    "id": 2,
    "group_id": 0,
    "tests": [
        {
            "description": "Check if the 'wazuh-logcollector' daemon changes a command name in the log messages by the one defined in the 'alias' tag. For this purpose, the test will monitor a command using an alias. Then, it will verify that the 'reading command' event is generated. This event includes the output of the command executed and its alias. Finally, the test will verify that the Wazuh API returns the same values for the 'localfile' section that the configured one.",
            "wazuh_min_version": "4.2.0",
            "parameters": [
                {
                    "get_local_internal_options": {
                        "type": "fixture",
                        "brief": "Get local internal options from the module."
                    }
                },
                {
                    "configure_local_internal_options": {
                        "type": "fixture",
                        "brief": "Configure the Wazuh local internal options."
                    }
                },
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "restart_logcollector": {
                        "type": "fixture",
                        "brief": "Clear the 'ossec.log' file and start a new monitor."
                    }
                }
            ],
            "assertions": [
                "Verify that the logcollector monitors a command with an assigned alias.",
                "Verify that the Wazuh API returns the same values for the 'localfile' section as the configured one."
            ],
            "input_description": "A configuration template (test_basic_configuration_alias) is contained in an external YAML file (wazuh_basic_configuration.yaml). That template is combined with two test cases defined in the module. Those include configuration settings for the 'wazuh-logcollector' daemon.",
            "expected_output": [
                "r'Reading command message.*'"
            ],
            "tags": [
                "logs"
            ],
            "name": "test_configuration_alias",
            "inputs": [
                "command_ps -aux_alias",
                "full_command_ps -aux_alias2"
            ]
        }
    ]
}

test_basic_configuration_alias.yaml

brief: The 'wazuh-logcollector' daemon monitors configured files and commands for
  new log messages. Specifically, these tests will check if the log collector generates
  events using the alias specified in the 'alias' tag when monitoring a command, and
  the Wazuh API returns the same values for the configured 'localfile' section. Log
  data collection is the real-time process of making sense out of the records generated
  by servers or devices. This component can receive logs through text files or Windows
  event logs. It can also directly receive logs via remote syslog which is useful
  for firewalls and other such devices.
components:
- agent
- manager
copyright: 'Copyright (C) 2015-2021, Wazuh Inc.

  Created by Wazuh, Inc. <[email protected]>.

  This program is free software; you can redistribute it and/or modify it under the
  terms of GPLv2'
daemons:
- wazuh-logcollector
- wazuh-apid
group_id: 0
id: 2
modules:
- logcollector
name: test_basic_configuration_alias.py
os_platform:
- linux
- windows
os_version:
- Arch Linux
- Amazon Linux 2
- Amazon Linux 1
- CentOS 8
- CentOS 7
- CentOS 6
- Ubuntu Focal
- Ubuntu Bionic
- Ubuntu Xenial
- Ubuntu Trusty
- Debian Buster
- Debian Stretch
- Debian Jessie
- Debian Wheezy
- Red Hat 8
- Red Hat 7
- Red Hat 6
- Windows 10
- Windows 8
- Windows 7
- Windows Server 2019
- Windows Server 2016
- Windows Server 2012
- Windows Server 2003
- Windows XP
references:
- https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html
- https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#alias
tags:
- logcollector_configuration
tests:
- assertions:
  - Verify that the logcollector monitors a command with an assigned alias.
  - Verify that the Wazuh API returns the same values for the 'localfile' section
    as the configured one.
  description: Check if the 'wazuh-logcollector' daemon changes a command name in
    the log messages by the one defined in the 'alias' tag. For this purpose, the
    test will monitor a command using an alias. Then, it will verify that the 'reading
    command' event is generated. This event includes the output of the command executed
    and its alias. Finally, the test will verify that the Wazuh API returns the same
    values for the 'localfile' section that the configured one.
  expected_output:
  - r'Reading command message.*'
  input_description: A configuration template (test_basic_configuration_alias) is
    contained in an external YAML file (wazuh_basic_configuration.yaml). That template
    is combined with two test cases defined in the module. Those include configuration
    settings for the 'wazuh-logcollector' daemon.
  inputs:
  - command_ps -aux_alias
  - full_command_ps -aux_alias2
  name: test_configuration_alias
  parameters:
  - get_local_internal_options:
      brief: Get local internal options from the module.
      type: fixture
  - configure_local_internal_options:
      brief: Configure the Wazuh local internal options.
      type: fixture
  - get_configuration:
      brief: Get configurations from the module.
      type: fixture
  - configure_environment:
      brief: Configure a custom environment for testing.
      type: fixture
  - restart_logcollector:
      brief: Clear the 'ossec.log' file and start a new monitor.
      type: fixture
  tags:
  - logs
  wazuh_min_version: 4.2.0
tier: 0
type: integration

 

test_basic_configuration_command.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The 'wazuh-logcollector' daemon monitors configured files and commands for new log messages. Specifically, these tests will check if monitored commands that use several parameters are correctly executed by the logcollector, and the Wazuh API returns the same values for the configured 'localfile' section. Log data collection is the real-time process of making sense out of the records generated by servers or devices. This component can receive logs through text files or Windows event logs. It can also directly receive logs via remote syslog which is useful for firewalls and other such devices.",
    "tier": 0,
    "modules": [
        "logcollector"
    ],
    "components": [
        "agent",
        "manager"
    ],
    "daemons": [
        "wazuh-logcollector",
        "wazuh-apid"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2019",
        "Windows Server 2016",
        "Windows Server 2012",
        "Windows Server 2003",
        "Windows XP"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html",
        "https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#command",
        "https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#alias",
        "https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#log-format"
    ],
    "tags": [
        "logcollector_configuration"
    ],
    "name": "test_basic_configuration_command.py",
    "id": 3,
    "group_id": 0,
    "tests": [
        {
            "description": "Check if the 'wazuh-logcollector' daemon can monitor commands that use multiple parameters. For this purpose, the test will configure the logcollector to monitor a command, setting it in the 'command' tag. Once the logcollector has started, it will check if the 'monitoring' event, indicating that the command is being monitored, has been generated. Finally, the test will verify that the Wazuh API returns the same values for the 'localfile' section that the configured one.",
            "wazuh_min_version": "4.2.0",
            "parameters": [
                {
                    "get_local_internal_options": {
                        "type": "fixture",
                        "brief": "Get local internal options from the module."
                    }
                },
                {
                    "configure_local_internal_options": {
                        "type": "fixture",
                        "brief": "Configure the Wazuh local internal options."
                    }
                },
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "restart_logcollector": {
                        "type": "fixture",
                        "brief": "Clear the 'ossec.log' file and start a new monitor."
                    }
                }
            ],
            "assertions": [
                "Verify that the logcollector monitors the command specified in the 'command' tag.",
                "Verify that the Wazuh API returns the same values for the 'localfile' section as the configured one."
            ],
            "input_description": "A configuration template (test_basic_configuration_location) is contained in an external YAML file (wazuh_basic_configuration.yaml). That template is combined with different test cases defined in the module. Those include configuration settings for the 'wazuh-logcollector' daemon.",
            "expected_output": [
                {
                    "r'INFO": "Monitoring .* of command.*'"
                }
            ],
            "tags": [
                "logs"
            ],
            "name": "test_configuration_command",
            "inputs": [
                "command_echo Testing",
                "command_df -P",
                "command_find / -type f -perm 4000",
                "command_ls /tmp/*",
                "command_/tmp/script/my_script -a 1 -v 2 -b 3 -g 444 -k Testing",
                "full_command_echo Testing",
                "full_command_df -P",
                "full_command_find / -type f -perm 4000",
                "full_command_ls /tmp/*",
                "full_command_/tmp/script/my_script -a 1 -v 2 -b 3 -g 444 -k Testing"
            ]
        }
    ]
}

test_basic_configuration_command.yaml

brief: The 'wazuh-logcollector' daemon monitors configured files and commands for
  new log messages. Specifically, these tests will check if monitored commands that
  use several parameters are correctly executed by the logcollector, and the Wazuh
  API returns the same values for the configured 'localfile' section. Log data collection
  is the real-time process of making sense out of the records generated by servers
  or devices. This component can receive logs through text files or Windows event
  logs. It can also directly receive logs via remote syslog which is useful for firewalls
  and other such devices.
components:
- agent
- manager
copyright: 'Copyright (C) 2015-2021, Wazuh Inc.

  Created by Wazuh, Inc. <[email protected]>.

  This program is free software; you can redistribute it and/or modify it under the
  terms of GPLv2'
daemons:
- wazuh-logcollector
- wazuh-apid
group_id: 0
id: 3
modules:
- logcollector
name: test_basic_configuration_command.py
os_platform:
- linux
- windows
os_version:
- Arch Linux
- Amazon Linux 2
- Amazon Linux 1
- CentOS 8
- CentOS 7
- CentOS 6
- Ubuntu Focal
- Ubuntu Bionic
- Ubuntu Xenial
- Ubuntu Trusty
- Debian Buster
- Debian Stretch
- Debian Jessie
- Debian Wheezy
- Red Hat 8
- Red Hat 7
- Red Hat 6
- Windows 10
- Windows 8
- Windows 7
- Windows Server 2019
- Windows Server 2016
- Windows Server 2012
- Windows Server 2003
- Windows XP
references:
- https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html
- https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#command
- https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#alias
- https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#log-format
tags:
- logcollector_configuration
tests:
- assertions:
  - Verify that the logcollector monitors the command specified in the 'command' tag.
  - Verify that the Wazuh API returns the same values for the 'localfile' section
    as the configured one.
  description: Check if the 'wazuh-logcollector' daemon can monitor commands that
    use multiple parameters. For this purpose, the test will configure the logcollector
    to monitor a command, setting it in the 'command' tag. Once the logcollector has
    started, it will check if the 'monitoring' event, indicating that the command
    is being monitored, has been generated. Finally, the test will verify that the
    Wazuh API returns the same values for the 'localfile' section that the configured
    one.
  expected_output:
  - r'INFO: Monitoring .* of command.*'
  input_description: A configuration template (test_basic_configuration_location)
    is contained in an external YAML file (wazuh_basic_configuration.yaml). That template
    is combined with different test cases defined in the module. Those include configuration
    settings for the 'wazuh-logcollector' daemon.
  inputs:
  - command_echo Testing
  - command_df -P
  - command_find / -type f -perm 4000
  - command_ls /tmp/*
  - command_/tmp/script/my_script -a 1 -v 2 -b 3 -g 444 -k Testing
  - full_command_echo Testing
  - full_command_df -P
  - full_command_find / -type f -perm 4000
  - full_command_ls /tmp/*
  - full_command_/tmp/script/my_script -a 1 -v 2 -b 3 -g 444 -k Testing
  name: test_configuration_command
  parameters:
  - get_local_internal_options:
      brief: Get local internal options from the module.
      type: fixture
  - configure_local_internal_options:
      brief: Configure the Wazuh local internal options.
      type: fixture
  - get_configuration:
      brief: Get configurations from the module.
      type: fixture
  - configure_environment:
      brief: Configure a custom environment for testing.
      type: fixture
  - restart_logcollector:
      brief: Clear the 'ossec.log' file and start a new monitor.
      type: fixture
  tags:
  - logs
  wazuh_min_version: 4.2.0
tier: 0
type: integration

 

test_basic_configuration_exclude.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The 'wazuh-logcollector' daemon monitors configured files and commands for new log messages. Specifically, these tests will check if the Wazuh component (agent or manager) starts when the 'exclude' tag is set in the configuration, and the Wazuh API returns the same values for the configured 'localfile' section. Log data collection is the real-time process of making sense out of the records generated by servers or devices. This component can receive logs through text files or Windows event logs. It can also directly receive logs via remote syslog which is useful for firewalls and other such devices.",
    "tier": 0,
    "modules": [
        "logcollector"
    ],
    "components": [
        "agent",
        "manager"
    ],
    "daemons": [
        "wazuh-logcollector",
        "wazuh-apid"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2019",
        "Windows Server 2016",
        "Windows Server 2012",
        "Windows Server 2003",
        "Windows XP"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html",
        "https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#exclude"
    ],
    "tags": [
        "logcollector_configuration"
    ],
    "name": "test_basic_configuration_exclude.py",
    "id": 4,
    "group_id": 0,
    "tests": [
        {
            "description": "Check if the 'wazuh-logcollector' daemon starts properly when the 'exclude' tag is used. For this purpose, the test will configure the logcollector to monitor a 'syslog' directory and exclude log files by setting a wildcard in the 'exclude' tag. Finally, the test will verify that the Wazuh component is started by checking its process, and the Wazuh API returns the same values for the 'localfile' section that the configured one.",
            "wazuh_min_version": "4.2.0",
            "parameters": [
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "restart_logcollector": {
                        "type": "fixture",
                        "brief": "Clear the 'ossec.log' file and start a new monitor."
                    }
                }
            ],
            "assertions": [
                "Verify that the Wazuh component (agent or manager) can start when the 'exclude' tag is used.",
                "Verify that the Wazuh API returns the same value for the 'localfile' section as the configured one."
            ],
            "input_description": "A configuration template (test_basic_configuration_exclude) is contained in an external YAML file (wazuh_basic_configuration.yaml). That template is combined with different test cases defined in the module. Those include configuration settings for the 'wazuh-logcollector' daemon.",
            "expected_output": [
                "Boolean values to indicate the state of the Wazuh component."
            ],
            "name": "test_configuration_exclude",
            "inputs": [
                "syslog_/tmp/testing/*_/tmp/testing/file.txt",
                "syslog_/tmp/testing/*_/tmp/testing/f*",
                "syslog_/tmp/testing/*_/tmp/testing/*g",
                "syslog_/tmp/testing/*_/tmp/testing/file?.txt",
                "syslog_/tmp/testing/*_/tmp/testing/file.log-%Y-%m-%d"
            ]
        }
    ]
}

test_basic_configuration_exclude.yaml

brief: The 'wazuh-logcollector' daemon monitors configured files and commands for
  new log messages. Specifically, these tests will check if the Wazuh component (agent
  or manager) starts when the 'exclude' tag is set in the configuration, and the Wazuh
  API returns the same values for the configured 'localfile' section. Log data collection
  is the real-time process of making sense out of the records generated by servers
  or devices. This component can receive logs through text files or Windows event
  logs. It can also directly receive logs via remote syslog which is useful for firewalls
  and other such devices.
components:
- agent
- manager
copyright: 'Copyright (C) 2015-2021, Wazuh Inc.

  Created by Wazuh, Inc. <[email protected]>.

  This program is free software; you can redistribute it and/or modify it under the
  terms of GPLv2'
daemons:
- wazuh-logcollector
- wazuh-apid
group_id: 0
id: 4
modules:
- logcollector
name: test_basic_configuration_exclude.py
os_platform:
- linux
- windows
os_version:
- Arch Linux
- Amazon Linux 2
- Amazon Linux 1
- CentOS 8
- CentOS 7
- CentOS 6
- Ubuntu Focal
- Ubuntu Bionic
- Ubuntu Xenial
- Ubuntu Trusty
- Debian Buster
- Debian Stretch
- Debian Jessie
- Debian Wheezy
- Red Hat 8
- Red Hat 7
- Red Hat 6
- Windows 10
- Windows 8
- Windows 7
- Windows Server 2019
- Windows Server 2016
- Windows Server 2012
- Windows Server 2003
- Windows XP
references:
- https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html
- https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#exclude
tags:
- logcollector_configuration
tests:
- assertions:
  - Verify that the Wazuh component (agent or manager) can start when the 'exclude'
    tag is used.
  - Verify that the Wazuh API returns the same value for the 'localfile' section as
    the configured one.
  description: Check if the 'wazuh-logcollector' daemon starts properly when the 'exclude'
    tag is used. For this purpose, the test will configure the logcollector to monitor
    a 'syslog' directory and exclude log files by setting a wildcard in the 'exclude'
    tag. Finally, the test will verify that the Wazuh component is started by checking
    its process, and the Wazuh API returns the same values for the 'localfile' section
    that the configured one.
  expected_output:
  - Boolean values to indicate the state of the Wazuh component.
  input_description: A configuration template (test_basic_configuration_exclude) is
    contained in an external YAML file (wazuh_basic_configuration.yaml). That template
    is combined with different test cases defined in the module. Those include configuration
    settings for the 'wazuh-logcollector' daemon.
  inputs:
  - syslog_/tmp/testing/*_/tmp/testing/file.txt
  - syslog_/tmp/testing/*_/tmp/testing/f*
  - syslog_/tmp/testing/*_/tmp/testing/*g
  - syslog_/tmp/testing/*_/tmp/testing/file?.txt
  - syslog_/tmp/testing/*_/tmp/testing/file.log-%Y-%m-%d
  name: test_configuration_exclude
  parameters:
  - get_configuration:
      brief: Get configurations from the module.
      type: fixture
  - configure_environment:
      brief: Configure a custom environment for testing.
      type: fixture
  - restart_logcollector:
      brief: Clear the 'ossec.log' file and start a new monitor.
      type: fixture
  wazuh_min_version: 4.2.0
tier: 0
type: integration

 

test_basic_configuration_frequency.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The 'wazuh-logcollector' daemon monitors configured files and commands for new log messages. Specifically, these tests will check if the logcollector detects invalid values for the 'frequency' tag and the Wazuh API returns the same values for the configured 'localfile' section. Log data collection is the real-time process of making sense out of the records generated by servers or devices. This component can receive logs through text files or Windows event logs. It can also directly receive logs via remote syslog which is useful for firewalls and other such devices.",
    "tier": 0,
    "modules": [
        "logcollector"
    ],
    "components": [
        "agent",
        "manager"
    ],
    "daemons": [
        "wazuh-logcollector",
        "wazuh-apid"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2019",
        "Windows Server 2016",
        "Windows Server 2012",
        "Windows Server 2003",
        "Windows XP"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html",
        "https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#frequency"
    ],
    "tags": [
        "logcollector_configuration"
    ],
    "name": "test_basic_configuration_frequency.py",
    "id": 5,
    "group_id": 0,
    "tests": [
        {
            "description": "Check if the 'wazuh-logcollector' daemon detects invalid configurations for the 'frequency' tag. For this purpose, the test will set a 'localfile' section using valid/invalid values for that tag. Then, it will check if the 'monitoring' event is triggered when using a valid value, or if an error event is generated when using an invalid one. Finally, the test will verify that the Wazuh API returns the same values for the 'localfile' section that the configured one.",
            "wazuh_min_version": "4.2.0",
            "parameters": [
                {
                    "get_local_internal_options": {
                        "type": "fixture",
                        "brief": "Get local internal options from the module."
                    }
                },
                {
                    "configure_local_internal_options": {
                        "type": "fixture",
                        "brief": "Configure the Wazuh local internal options."
                    }
                },
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                }
            ],
            "assertions": [
                "Verify that the logcollector generates error events when using invalid values for the 'frequency' tag.",
                "Verify that the logcollector generates 'monitoring' events when using valid values for the 'frequency' tag.",
                "Verify that the Wazuh API returns the same values for the 'localfile' section as the configured one."
            ],
            "input_description": "A configuration template (test_basic_configuration_frequency) is contained in an external YAML file (wazuh_basic_configuration.yaml). That template is combined with different test cases defined in the module. Those include configuration settings for the 'wazuh-logcollector' daemon.",
            "expected_output": [
                {
                    "r'INFO": "Monitoring .* of command.*'"
                },
                "r'Invalid value for element .*'",
                "r'Configuration error at .*'"
            ],
            "tags": [
                "invalid_settings"
            ],
            "name": "test_configuration_frequency",
            "inputs": [
                "command_ps -aux_3",
                "command_ps -aux_10",
                "command_ps -aux_100000",
                "command_ps -aux_3s",
                "command_ps -aux_Testing",
                "command_ps -aux_3Testing",
                "command_ps -aux_3s5m",
                "command_ps -aux_Testing3",
                "full_command_ps -aux_3",
                "full_command_ps -aux_10",
                "full_command_ps -aux_100000",
                "full_command_ps -aux_3s",
                "full_command_ps -aux_Testing",
                "full_command_ps -aux_3Testing",
                "full_command_ps -aux_3s5m",
                "full_command_ps -aux_Testing3"
            ]
        }
    ]
}

test_basic_configuration_frequency.yaml

brief: The 'wazuh-logcollector' daemon monitors configured files and commands for
  new log messages. Specifically, these tests will check if the logcollector detects
  invalid values for the 'frequency' tag and the Wazuh API returns the same values
  for the configured 'localfile' section. Log data collection is the real-time process
  of making sense out of the records generated by servers or devices. This component
  can receive logs through text files or Windows event logs. It can also directly
  receive logs via remote syslog which is useful for firewalls and other such devices.
components:
- agent
- manager
copyright: 'Copyright (C) 2015-2021, Wazuh Inc.

  Created by Wazuh, Inc. <[email protected]>.

  This program is free software; you can redistribute it and/or modify it under the
  terms of GPLv2'
daemons:
- wazuh-logcollector
- wazuh-apid
group_id: 0
id: 5
modules:
- logcollector
name: test_basic_configuration_frequency.py
os_platform:
- linux
- windows
os_version:
- Arch Linux
- Amazon Linux 2
- Amazon Linux 1
- CentOS 8
- CentOS 7
- CentOS 6
- Ubuntu Focal
- Ubuntu Bionic
- Ubuntu Xenial
- Ubuntu Trusty
- Debian Buster
- Debian Stretch
- Debian Jessie
- Debian Wheezy
- Red Hat 8
- Red Hat 7
- Red Hat 6
- Windows 10
- Windows 8
- Windows 7
- Windows Server 2019
- Windows Server 2016
- Windows Server 2012
- Windows Server 2003
- Windows XP
references:
- https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html
- https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#frequency
tags:
- logcollector_configuration
tests:
- assertions:
  - Verify that the logcollector generates error events when using invalid values
    for the 'frequency' tag.
  - Verify that the logcollector generates 'monitoring' events when using valid values
    for the 'frequency' tag.
  - Verify that the Wazuh API returns the same values for the 'localfile' section
    as the configured one.
  description: Check if the 'wazuh-logcollector' daemon detects invalid configurations
    for the 'frequency' tag. For this purpose, the test will set a 'localfile' section
    using valid/invalid values for that tag. Then, it will check if the 'monitoring'
    event is triggered when using a valid value, or if an error event is generated
    when using an invalid one. Finally, the test will verify that the Wazuh API returns
    the same values for the 'localfile' section that the configured one.
  expected_output:
  - r'INFO: Monitoring .* of command.*'
  - r'Invalid value for element .*'
  - r'Configuration error at .*'
  input_description: A configuration template (test_basic_configuration_frequency)
    is contained in an external YAML file (wazuh_basic_configuration.yaml). That template
    is combined with different test cases defined in the module. Those include configuration
    settings for the 'wazuh-logcollector' daemon.
  inputs:
  - command_ps -aux_3
  - command_ps -aux_10
  - command_ps -aux_100000
  - command_ps -aux_3s
  - command_ps -aux_Testing
  - command_ps -aux_3Testing
  - command_ps -aux_3s5m
  - command_ps -aux_Testing3
  - full_command_ps -aux_3
  - full_command_ps -aux_10
  - full_command_ps -aux_100000
  - full_command_ps -aux_3s
  - full_command_ps -aux_Testing
  - full_command_ps -aux_3Testing
  - full_command_ps -aux_3s5m
  - full_command_ps -aux_Testing3
  name: test_configuration_frequency
  parameters:
  - get_local_internal_options:
      brief: Get local internal options from the module.
      type: fixture
  - configure_local_internal_options:
      brief: Configure the Wazuh local internal options.
      type: fixture
  - get_configuration:
      brief: Get configurations from the module.
      type: fixture
  - configure_environment:
      brief: Configure a custom environment for testing.
      type: fixture
  tags:
  - invalid_settings
  wazuh_min_version: 4.2.0
tier: 0
type: integration

 

test_basic_configuration_ignore_binaries.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The 'wazuh-logcollector' daemon monitors configured files and commands for new log messages. Specifically, these tests will check if the logcollector detects invalid values for the 'ignore_binaries' tag and the Wazuh API returns the same values for the configured 'localfile' section. Log data collection is the real-time process of making sense out of the records generated by servers or devices. This component can receive logs through text files or Windows event logs. It can also directly receive logs via remote syslog which is useful for firewalls and other such devices.",
    "tier": 0,
    "modules": [
        "logcollector"
    ],
    "components": [
        "agent",
        "manager"
    ],
    "daemons": [
        "wazuh-logcollector",
        "wazuh-apid"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2019",
        "Windows Server 2016",
        "Windows Server 2012",
        "Windows Server 2003",
        "Windows XP"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html",
        "https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#ignore_binaries"
    ],
    "tags": [
        "logcollector_configuration"
    ],
    "name": "test_basic_configuration_ignore_binaries.py",
    "id": 6,
    "group_id": 0,
    "tests": [
        {
            "description": "Check if the 'wazuh-logcollector' daemon detects invalid configurations for the 'ignore_binaries' tag. For this purpose, the test will set a 'localfile' section using valid/invalid values for that tag. Then, it will check if an error event is generated when using an invalid value. Finally, the test will verify that the Wazuh API returns the same values for the 'localfile' section that the configured one.",
            "wazuh_min_version": "4.2.0",
            "parameters": [
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                }
            ],
            "assertions": [
                "Verify that the logcollector generates error events when using invalid values for the 'ignore_binaries' tag.",
                "Verify that the Wazuh API returns the same values for the 'localfile' section as the configured one."
            ],
            "input_description": "A configuration template (test_basic_configuration_ignore_binaries) is contained in an external YAML file (wazuh_basic_configuration.yaml). That template is combined with different test cases defined in the module. Those include configuration settings for the 'wazuh-logcollector' daemon.",
            "expected_output": [
                "r'Invalid value for element .*'",
                "r'Configuration error at .*'"
            ],
            "tags": [
                "invalid_settings"
            ],
            "name": "test_ignore_binaries",
            "inputs": [
                "/tmp/testing/files*_syslog_yes",
                "/tmp/testing/files*_syslog_no",
                "/tmp/testing/files*_syslog_yesTesting",
                "/tmp/testing/files*_syslog_noTesting",
                "/tmp/testing/files*_syslog_testingvalue",
                "/tmp/testing/files*_syslog_1234"
            ]
        }
    ]
}

test_basic_configuration_ignore_binaries.yaml

brief: The 'wazuh-logcollector' daemon monitors configured files and commands for
  new log messages. Specifically, these tests will check if the logcollector detects
  invalid values for the 'ignore_binaries' tag and the Wazuh API returns the same
  values for the configured 'localfile' section. Log data collection is the real-time
  process of making sense out of the records generated by servers or devices. This
  component can receive logs through text files or Windows event logs. It can also
  directly receive logs via remote syslog which is useful for firewalls and other
  such devices.
components:
- agent
- manager
copyright: 'Copyright (C) 2015-2021, Wazuh Inc.

  Created by Wazuh, Inc. <[email protected]>.

  This program is free software; you can redistribute it and/or modify it under the
  terms of GPLv2'
daemons:
- wazuh-logcollector
- wazuh-apid
group_id: 0
id: 6
modules:
- logcollector
name: test_basic_configuration_ignore_binaries.py
os_platform:
- linux
- windows
os_version:
- Arch Linux
- Amazon Linux 2
- Amazon Linux 1
- CentOS 8
- CentOS 7
- CentOS 6
- Ubuntu Focal
- Ubuntu Bionic
- Ubuntu Xenial
- Ubuntu Trusty
- Debian Buster
- Debian Stretch
- Debian Jessie
- Debian Wheezy
- Red Hat 8
- Red Hat 7
- Red Hat 6
- Windows 10
- Windows 8
- Windows 7
- Windows Server 2019
- Windows Server 2016
- Windows Server 2012
- Windows Server 2003
- Windows XP
references:
- https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html
- https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#ignore_binaries
tags:
- logcollector_configuration
tests:
- assertions:
  - Verify that the logcollector generates error events when using invalid values
    for the 'ignore_binaries' tag.
  - Verify that the Wazuh API returns the same values for the 'localfile' section
    as the configured one.
  description: Check if the 'wazuh-logcollector' daemon detects invalid configurations
    for the 'ignore_binaries' tag. For this purpose, the test will set a 'localfile'
    section using valid/invalid values for that tag. Then, it will check if an error
    event is generated when using an invalid value. Finally, the test will verify
    that the Wazuh API returns the same values for the 'localfile' section that the
    configured one.
  expected_output:
  - r'Invalid value for element .*'
  - r'Configuration error at .*'
  input_description: A configuration template (test_basic_configuration_ignore_binaries)
    is contained in an external YAML file (wazuh_basic_configuration.yaml). That template
    is combined with different test cases defined in the module. Those include configuration
    settings for the 'wazuh-logcollector' daemon.
  inputs:
  - /tmp/testing/files*_syslog_yes
  - /tmp/testing/files*_syslog_no
  - /tmp/testing/files*_syslog_yesTesting
  - /tmp/testing/files*_syslog_noTesting
  - /tmp/testing/files*_syslog_testingvalue
  - /tmp/testing/files*_syslog_1234
  name: test_ignore_binaries
  parameters:
  - get_configuration:
      brief: Get configurations from the module.
      type: fixture
  - configure_environment:
      brief: Configure a custom environment for testing.
      type: fixture
  tags:
  - invalid_settings
  wazuh_min_version: 4.2.0
tier: 0
type: integration

 

test_basic_configuration_label.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The 'wazuh-logcollector' daemon monitors configured files and commands for new log messages. Specifically, these tests will check if the Wazuh component (agent or manager) starts when the 'label' tag is set in the configuration, and the Wazuh API returns the same values for the configured 'localfile' section. Log data collection is the real-time process of making sense out of the records generated by servers or devices. This component can receive logs through text files or Windows event logs. It can also directly receive logs via remote syslog which is useful for firewalls and other such devices.",
    "tier": 0,
    "modules": [
        "logcollector"
    ],
    "components": [
        "agent",
        "manager"
    ],
    "daemons": [
        "wazuh-logcollector",
        "wazuh-apid"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2019",
        "Windows Server 2016",
        "Windows Server 2012",
        "Windows Server 2003",
        "Windows XP"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html",
        "https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#label"
    ],
    "tags": [
        "logcollector_configuration"
    ],
    "name": "test_basic_configuration_label.py",
    "id": 7,
    "group_id": 0,
    "tests": [
        {
            "description": "Check if the 'wazuh-logcollector' daemon can monitor log files configured to use labels. For this purpose, the test will configure the logcollector to use labels, setting them in the label 'tag'. Once the logcollector has started, it will check if the 'analyzing' event, indicating that the testing log file is being monitored, has been generated. Finally, the test will verify that the Wazuh API returns the same values for the 'localfile' section that the configured one.",
            "wazuh_min_version": "4.2.0",
            "parameters": [
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "restart_logcollector": {
                        "type": "fixture",
                        "brief": "Clear the 'ossec.log' file and start a new monitor."
                    }
                }
            ],
            "assertions": [
                "Verify that the logcollector monitors files when using the 'label' tag.",
                "Verify that the Wazuh API returns the same values for the 'localfile' section as the configured one."
            ],
            "input_description": "A configuration template (test_basic_configuration_label) is contained in an external YAML file (wazuh_basic_configuration.yaml). That template is combined with different test cases defined in the module. Those include configuration settings for the 'wazuh-logcollector' daemon.",
            "expected_output": [
                "r'Analyzing file.*'"
            ],
            "tags": [
                "invalid_settings",
                "logs"
            ],
            "name": "test_configuration_label",
            "inputs": [
                "/tmp/testing.txt_myapp_@source",
                "/tmp/testing.txt_myapp_agent.type",
                "/tmp/testing.txt_myapp_agent.location",
                "/tmp/testing.txt_myapp_agent.idgroup",
                "/tmp/testing.txt_myapp_group.groupnname",
                "/tmp/testing.txt_myapp_109304",
                "/tmp/testing.txt_myapp_TestingTagNames",
                "/tmp/testing.txt_myapp_?\\xbfatag_tname"
            ]
        }
    ]
}

test_basic_configuration_label.yaml

brief: The 'wazuh-logcollector' daemon monitors configured files and commands for
  new log messages. Specifically, these tests will check if the Wazuh component (agent
  or manager) starts when the 'label' tag is set in the configuration, and the Wazuh
  API returns the same values for the configured 'localfile' section. Log data collection
  is the real-time process of making sense out of the records generated by servers
  or devices. This component can receive logs through text files or Windows event
  logs. It can also directly receive logs via remote syslog which is useful for firewalls
  and other such devices.
components:
- agent
- manager
copyright: 'Copyright (C) 2015-2021, Wazuh Inc.

  Created by Wazuh, Inc. <[email protected]>.

  This program is free software; you can redistribute it and/or modify it under the
  terms of GPLv2'
daemons:
- wazuh-logcollector
- wazuh-apid
group_id: 0
id: 7
modules:
- logcollector
name: test_basic_configuration_label.py
os_platform:
- linux
- windows
os_version:
- Arch Linux
- Amazon Linux 2
- Amazon Linux 1
- CentOS 8
- CentOS 7
- CentOS 6
- Ubuntu Focal
- Ubuntu Bionic
- Ubuntu Xenial
- Ubuntu Trusty
- Debian Buster
- Debian Stretch
- Debian Jessie
- Debian Wheezy
- Red Hat 8
- Red Hat 7
- Red Hat 6
- Windows 10
- Windows 8
- Windows 7
- Windows Server 2019
- Windows Server 2016
- Windows Server 2012
- Windows Server 2003
- Windows XP
references:
- https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html
- https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#label
tags:
- logcollector_configuration
tests:
- assertions:
  - Verify that the logcollector monitors files when using the 'label' tag.
  - Verify that the Wazuh API returns the same values for the 'localfile' section
    as the configured one.
  description: Check if the 'wazuh-logcollector' daemon can monitor log files configured
    to use labels. For this purpose, the test will configure the logcollector to use
    labels, setting them in the label 'tag'. Once the logcollector has started, it
    will check if the 'analyzing' event, indicating that the testing log file is being
    monitored, has been generated. Finally, the test will verify that the Wazuh API
    returns the same values for the 'localfile' section that the configured one.
  expected_output:
  - r'Analyzing file.*'
  input_description: A configuration template (test_basic_configuration_label) is
    contained in an external YAML file (wazuh_basic_configuration.yaml). That template
    is combined with different test cases defined in the module. Those include configuration
    settings for the 'wazuh-logcollector' daemon.
  inputs:
  - /tmp/testing.txt_myapp_@source
  - /tmp/testing.txt_myapp_agent.type
  - /tmp/testing.txt_myapp_agent.location
  - /tmp/testing.txt_myapp_agent.idgroup
  - /tmp/testing.txt_myapp_group.groupnname
  - /tmp/testing.txt_myapp_109304
  - /tmp/testing.txt_myapp_TestingTagNames
  - /tmp/testing.txt_myapp_?\xbfatag_tname
  name: test_configuration_label
  parameters:
  - get_configuration:
      brief: Get configurations from the module.
      type: fixture
  - configure_environment:
      brief: Configure a custom environment for testing.
      type: fixture
  - restart_logcollector:
      brief: Clear the 'ossec.log' file and start a new monitor.
      type: fixture
  tags:
  - invalid_settings
  - logs
  wazuh_min_version: 4.2.0
tier: 0
type: integration

Tests

  • Python codebase satisfies PEP-8 style style guide. pycodestyle --max-line-length=120 --show-source --show-pep8 file.py.
  • The DocGenerator sanity check test does not return errors. python3 DocGenerator.py -s

…in QA Docs style

The current scheme of the issue #1694 has been used.
PEP-8 fixes.

Related: #1796
@mdengra mdengra self-assigned this Nov 3, 2021
@mdengra mdengra linked an issue Nov 3, 2021 that may be closed by this pull request
50 tasks
roronoasins
roronoasins previously approved these changes Nov 3, 2021
Copy link
Contributor

@roronoasins roronoasins left a comment

Choose a reason for hiding this comment

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

👍

…migrate-doc-logc-configuration-1
@fernandolojano
Copy link
Contributor

QA-docs execution

test_basic_configuration_age

Results

qa-docs --tests-path  /home/reko/repos/testing-wazuh/PR2163/wazuh-qa/tests/integration/test_logcollector/ -t  test_basic_configuration_age
2022-01-07 13:24:57,304 - INFO - Looking for test_basic_configuration_age.py
2022-01-07 13:24:57,304 - INFO - Parsing the following test(s) ['test_basic_configuration_age']
2022-01-07 13:24:57,316 - INFO - Running QADOCS
2022-01-07 13:24:57,317 - INFO - Looking for test_basic_configuration_age.py
2022-01-07 13:24:57,538 - INFO - Run completed, documentation location: /tmp/qa_docs/output

Generated documentation

test_basic_configuration_age.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The 'wazuh-logcollector' daemon monitors configured files and commands for new log messages. Specifically, these tests will check if the logcollector detects invalid values for the 'age' tag and the Wazuh API returns the same values for the configured 'localfile' section. Log data collection is the real-time process of making sense out of the records generated by servers or devices. This component can receive logs through text files or Windows event logs. It can also directly receive logs via remote syslog which is useful for firewalls and other such devices.",
    "tier": 0,
    "modules": [
        "logcollector"
    ],
    "components": [
        "agent",
        "manager"
    ],
    "daemons": [
        "wazuh-logcollector",
        "wazuh-apid"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2019",
        "Windows Server 2016",
        "Windows Server 2012",
        "Windows Server 2003",
        "Windows XP"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html",
        "https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#age"
    ],
    "tags": [
        "logcollector_configuration"
    ],
    "name": "test_basic_configuration_age.py",
    "id": 1,
    "group_id": 0,
    "path": "tests/integration/test_logcollector/test_configuration/test_basic_configuration_age.py",
    "tests": [
        {
            "description": "Check if the 'wazuh-logcollector' daemon detects invalid configurations for the 'age' tag. For this purpose, the test will set a 'localfile' section using valid/invalid values for that tag. Then, it will check if the 'analyzing' event is triggered when using a valid value, or if an error event is generated when using an invalid one. Finally, the test will verify that the Wazuh API returns the same values for the 'localfile' section that the configured one.",
            "wazuh_min_version": "4.2.0",
            "parameters": [
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                }
            ],
            "assertions": [
                "Verify that the logcollector generates error events when using invalid values for the 'age' tag.",
                "Verify that the logcollector generates 'analyzing' events when using valid values for the 'age' tag.",
                "Verify that the Wazuh API returns the same values for the 'localfile' section as the configured one."
            ],
            "input_description": "A configuration template (test_basic_configuration_age) is contained in an external YAML file (wazuh_basic_configuration.yaml). That template is combined with different test cases defined in the module. Those include configuration settings for the 'wazuh-logcollector' daemon.",
            "expected_output": [
                "r'Analyzing file.*'",
                "r'Invalid .* for localfile'",
                "r'Configuration error at .*'"
            ],
            "tags": [
                "invalid_settings"
            ],
            "name": "test_configuration_age"
        }
    ]
}

test_basic_configuration_alias

Results

(testing-wazuh) reko@R98:~/repos/testing-wazuh/qa-docs/wazuh-qa/deps/wazuh_testing$ qa-docs --tests-path  /home/reko/repos/testing-wazuh/PR2163/wazuh-qa/tests/integration/test_logcollector/ -t  test_basic_configuration_alias
2022-01-07 13:32:01,355 - INFO - Looking for test_basic_configuration_alias.py
2022-01-07 13:32:01,355 - INFO - Parsing the following test(s) ['test_basic_configuration_alias']
2022-01-07 13:32:01,368 - INFO - Running QADOCS
2022-01-07 13:32:01,368 - INFO - Looking for test_basic_configuration_alias.py
2022-01-07 13:32:01,540 - INFO - Run completed, documentation location: /tmp/qa_docs/output

Generated documentation

test_basic_configuration_alias.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The 'wazuh-logcollector' daemon monitors configured files and commands for new log messages. Specifically, these tests will check if the log collector generates events using the alias specified in the 'alias' tag when monitoring a command, and the Wazuh API returns the same values for the configured 'localfile' section. Log data collection is the real-time process of making sense out of the records generated by servers or devices. This component can receive logs through text files or Windows event logs. It can also directly receive logs via remote syslog which is useful for firewalls and other such devices.",
    "tier": 0,
    "modules": [
        "logcollector"
    ],
    "components": [
        "agent",
        "manager"
    ],
    "daemons": [
        "wazuh-logcollector",
        "wazuh-apid"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2019",
        "Windows Server 2016",
        "Windows Server 2012",
        "Windows Server 2003",
        "Windows XP"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html",
        "https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#alias"
    ],
    "tags": [
        "logcollector_configuration"
    ],
    "name": "test_basic_configuration_alias.py",
    "id": 1,
    "group_id": 0,
    "path": "tests/integration/test_logcollector/test_configuration/test_basic_configuration_alias.py",
    "tests": [
        {
            "description": "Check if the 'wazuh-logcollector' daemon changes a command name in the log messages by the one defined in the 'alias' tag. For this purpose, the test will monitor a command using an alias. Then, it will verify that the 'reading command' event is generated. This event includes the output of the command executed and its alias. Finally, the test will verify that the Wazuh API returns the same values for the 'localfile' section that the configured one.",
            "wazuh_min_version": "4.2.0",
            "parameters": [
                {
                    "configure_local_internal_options_module": {
                        "type": "fixture",
                        "brief": "Configure the Wazuh local internal options."
                    }
                },
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "file_monitoring": {
                        "type": "fixture",
                        "brief": "Handle the monitoring of a specified file."
                    }
                },
                {
                    "restart_logcollector": {
                        "type": "fixture",
                        "brief": "Clear the 'ossec.log' file and start a new monitor."
                    }
                }
            ],
            "assertions": [
                "Verify that the logcollector monitors a command with an assigned alias.",
                "Verify that the Wazuh API returns the same values for the 'localfile' section as the configured one."
            ],
            "input_description": "A configuration template (test_basic_configuration_alias) is contained in an external YAML file (wazuh_basic_configuration.yaml). That template is combined with two test cases defined in the module. Those include configuration settings for the 'wazuh-logcollector' daemon.",
            "expected_output": [
                "r'Reading command message.*'"
            ],
            "tags": [
                "logs"
            ],
            "name": "test_configuration_alias"
        }
    ]
}

test_basic_configuration_command

Results

qa-docs --tests-path  /home/reko/repos/testing-wazuh/PR2163/wazuh-qa/tests/integration/test_logcollector/ -t  test_basic_configuration_command
2022-01-10 09:57:30,683 - INFO - Looking for test_basic_configuration_command.py
2022-01-10 09:57:30,684 - INFO - Parsing the following test(s) ['test_basic_configuration_command']
2022-01-10 09:57:30,696 - INFO - Running QADOCS
2022-01-10 09:57:30,696 - INFO - Looking for test_basic_configuration_command.py
2022-01-10 09:57:30,866 - INFO - Run completed, documentation location: /tmp/qa_docs/output

Generated documentation

test_basic_configuration_command.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The 'wazuh-logcollector' daemon monitors configured files and commands for new log messages. Specifically, these tests will check if monitored commands that use several parameters are correctly executed by the logcollector, and the Wazuh API returns the same values for the configured 'localfile' section. Log data collection is the real-time process of making sense out of the records generated by servers or devices. This component can receive logs through text files or Windows event logs. It can also directly receive logs via remote syslog which is useful for firewalls and other such devices.",
    "tier": 0,
    "modules": [
        "logcollector"
    ],
    "components": [
        "agent",
        "manager"
    ],
    "daemons": [
        "wazuh-logcollector",
        "wazuh-apid"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2019",
        "Windows Server 2016",
        "Windows Server 2012",
        "Windows Server 2003",
        "Windows XP"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html",
        "https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#command",
        "https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#alias",
        "https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#log-format"
    ],
    "tags": [
        "logcollector_configuration"
    ],
    "name": "test_basic_configuration_command.py",
    "id": 1,
    "group_id": 0,
    "path": "tests/integration/test_logcollector/test_configuration/test_basic_configuration_command.py",
    "tests": [
        {
            "description": "Check if the 'wazuh-logcollector' daemon can monitor commands that use multiple parameters. For this purpose, the test will configure the logcollector to monitor a command, setting it in the 'command' tag. Once the logcollector has started, it will check if the 'monitoring' event, indicating that the command is being monitored, has been generated. Finally, the test will verify that the Wazuh API returns the same values for the 'localfile' section that the configured one.",
            "wazuh_min_version": "4.2.0",
            "parameters": [
                {
                    "get_local_internal_options": {
                        "type": "fixture",
                        "brief": "Get local internal options from the module."
                    }
                },
                {
                    "configure_local_internal_options": {
                        "type": "fixture",
                        "brief": "Configure the Wazuh local internal options."
                    }
                },
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "restart_logcollector": {
                        "type": "fixture",
                        "brief": "Clear the 'ossec.log' file and start a new monitor."
                    }
                }
            ],
            "assertions": [
                "Verify that the logcollector monitors the command specified in the 'command' tag.",
                "Verify that the Wazuh API returns the same values for the 'localfile' section as the configured one."
            ],
            "input_description": "A configuration template (test_basic_configuration_location) is contained in an external YAML file (wazuh_basic_configuration.yaml). That template is combined with different test cases defined in the module. Those include configuration settings for the 'wazuh-logcollector' daemon.",
            "expected_output": [
                "r'INFO: Monitoring .* of command.*'"
            ],
            "tags": [
                "logs"
            ],
            "name": "test_configuration_command"
        }
    ]
}

test_basic_configuration_exclude

Results

qa-docs --tests-path  /home/reko/repos/testing-wazuh/PR2163/wazuh-qa/tests/integration/test_logcollector/ -t  test_basic_configuration_exclude
2022-01-10 11:18:13,521 - INFO - Looking for test_basic_configuration_exclude.py
2022-01-10 11:18:13,522 - INFO - Parsing the following test(s) ['test_basic_configuration_exclude']
2022-01-10 11:18:13,535 - INFO - Running QADOCS
2022-01-10 11:18:13,535 - INFO - Looking for test_basic_configuration_exclude.py
2022-01-10 11:18:13,757 - INFO - Run completed, documentation location: /tmp/qa_docs/output

Generated documentation

test_basic_configuration_exclude.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The 'wazuh-logcollector' daemon monitors configured files and commands for new log messages. Specifically, these tests will check if the Wazuh component (agent or manager) starts when the 'exclude' tag is set in the configuration, and the Wazuh API returns the same values for the configured 'localfile' section. Log data collection is the real-time process of making sense out of the records generated by servers or devices. This component can receive logs through text files or Windows event logs. It can also directly receive logs via remote syslog which is useful for firewalls and other such devices.",
    "tier": 0,
    "modules": [
        "logcollector"
    ],
    "components": [
        "agent",
        "manager"
    ],
    "daemons": [
        "wazuh-logcollector",
        "wazuh-apid"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2019",
        "Windows Server 2016",
        "Windows Server 2012",
        "Windows Server 2003",
        "Windows XP"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html",
        "https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#exclude"
    ],
    "tags": [
        "logcollector_configuration"
    ],
    "name": "test_basic_configuration_exclude.py",
    "id": 1,
    "group_id": 0,
    "path": "tests/integration/test_logcollector/test_configuration/test_basic_configuration_exclude.py",
    "tests": [
        {
            "description": "Check if the 'wazuh-logcollector' daemon starts properly when the 'exclude' tag is used. For this purpose, the test will configure the logcollector to monitor a 'syslog' directory and exclude log files by setting a wildcard in the 'exclude' tag. Finally, the test will verify that the Wazuh component is started by checking its process, and the Wazuh API returns the same values for the 'localfile' section that the configured one.",
            "wazuh_min_version": "4.2.0",
            "parameters": [
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "file_monitoring": {
                        "type": "fixture",
                        "brief": "Handle the monitoring of a specified file."
                    }
                },
                {
                    "restart_logcollector": {
                        "type": "fixture",
                        "brief": "Clear the 'ossec.log' file and start a new monitor."
                    }
                }
            ],
            "assertions": [
                "Verify that the Wazuh component (agent or manager) can start when the 'exclude' tag is used.",
                "Verify that the Wazuh API returns the same value for the 'localfile' section as the configured one."
            ],
            "input_description": "A configuration template (test_basic_configuration_exclude) is contained in an external YAML file (wazuh_basic_configuration.yaml). That template is combined with different test cases defined in the module. Those include configuration settings for the 'wazuh-logcollector' daemon.",
            "expected_output": [
                "Boolean values to indicate the state of the Wazuh component."
            ],
            "name": "test_configuration_exclude"
        }
    ]
}

test_basic_configuration_frequency

Results

(testing-wazuh) reko@R98:~/repos/testing-wazuh$ qa-docs --tests-path  /home/reko/repos/testing-wazuh/PR2163/wazuh-qa/tests/integration/test_logcollector/ -t  test_basic_configuration_frequency
2022-01-10 12:10:06,530 - INFO - Looking for test_basic_configuration_frequency.py
2022-01-10 12:10:06,531 - INFO - Parsing the following test(s) ['test_basic_configuration_frequency']
2022-01-10 12:10:06,543 - INFO - Running QADOCS
2022-01-10 12:10:06,543 - INFO - Looking for test_basic_configuration_frequency.py
2022-01-10 12:10:06,742 - INFO - Run completed, documentation location: /tmp/qa_docs/output

Generated documentation

test_basic_configuration_frequency.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The 'wazuh-logcollector' daemon monitors configured files and commands for new log messages. Specifically, these tests will check if the logcollector detects invalid values for the 'frequency' tag and the Wazuh API returns the same values for the configured 'localfile' section. Log data collection is the real-time process of making sense out of the records generated by servers or devices. This component can receive logs through text files or Windows event logs. It can also directly receive logs via remote syslog which is useful for firewalls and other such devices.",
    "tier": 0,
    "modules": [
        "logcollector"
    ],
    "components": [
        "agent",
        "manager"
    ],
    "daemons": [
        "wazuh-logcollector",
        "wazuh-apid"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2019",
        "Windows Server 2016",
        "Windows Server 2012",
        "Windows Server 2003",
        "Windows XP"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html",
        "https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#frequency"
    ],
    "tags": [
        "logcollector_configuration"
    ],
    "name": "test_basic_configuration_frequency.py",
    "id": 1,
    "group_id": 0,
    "path": "tests/integration/test_logcollector/test_configuration/test_basic_configuration_frequency.py",
    "tests": [
        {
            "description": "Check if the 'wazuh-logcollector' daemon detects invalid configurations for the 'frequency' tag. For this purpose, the test will set a 'localfile' section using valid/invalid values for that tag. Then, it will check if the 'monitoring' event is triggered when using a valid value, or if an error event is generated when using an invalid one. Finally, the test will verify that the Wazuh API returns the same values for the 'localfile' section that the configured one.",
            "wazuh_min_version": "4.2.0",
            "parameters": [
                {
                    "get_local_internal_options": {
                        "type": "fixture",
                        "brief": "Get local internal options from the module."
                    }
                },
                {
                    "configure_local_internal_options": {
                        "type": "fixture",
                        "brief": "Configure the Wazuh local internal options."
                    }
                },
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                }
            ],
            "assertions": [
                "Verify that the logcollector generates error events when using invalid values for the 'frequency' tag.",
                "Verify that the logcollector generates 'monitoring' events when using valid values for the 'frequency' tag.",
                "Verify that the Wazuh API returns the same values for the 'localfile' section as the configured one."
            ],
            "input_description": "A configuration template (test_basic_configuration_frequency) is contained in an external YAML file (wazuh_basic_configuration.yaml). That template is combined with different test cases defined in the module. Those include configuration settings for the 'wazuh-logcollector' daemon.",
            "expected_output": [
                "r'INFO: Monitoring .* of command.*'",
                "r'Invalid value for element .*'",
                "r'Configuration error at .*'"
            ],
            "tags": [
                "invalid_settings"
            ],
            "name": "test_configuration_frequency"
        }
    ]
}

test_basic_configuration_ignore_binaries

Results

(testing-wazuh) reko@R98:~/repos/testing-wazuh$ qa-docs --tests-path  /home/reko/repos/testing-wazuh/PR2163/wazuh-qa/tests/integration/test_logcollector/ -t  test_basic_configuration_ignore_binaries
2022-01-10 12:11:45,773 - INFO - Looking for test_basic_configuration_ignore_binaries.py
2022-01-10 12:11:45,773 - INFO - Parsing the following test(s) ['test_basic_configuration_ignore_binaries']
2022-01-10 12:11:45,786 - INFO - Running QADOCS
2022-01-10 12:11:45,786 - INFO - Looking for test_basic_configuration_ignore_binaries.py
2022-01-10 12:11:45,969 - INFO - Run completed, documentation location: /tmp/qa_docs/output

Generated documentation

test_basic_configuration_ignore_binaries.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The 'wazuh-logcollector' daemon monitors configured files and commands for new log messages. Specifically, these tests will check if the logcollector detects invalid values for the 'ignore_binaries' tag and the Wazuh API returns the same values for the configured 'localfile' section. Log data collection is the real-time process of making sense out of the records generated by servers or devices. This component can receive logs through text files or Windows event logs. It can also directly receive logs via remote syslog which is useful for firewalls and other such devices.",
    "tier": 0,
    "modules": [
        "logcollector"
    ],
    "components": [
        "agent",
        "manager"
    ],
    "daemons": [
        "wazuh-logcollector",
        "wazuh-apid"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2019",
        "Windows Server 2016",
        "Windows Server 2012",
        "Windows Server 2003",
        "Windows XP"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html",
        "https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#ignore_binaries"
    ],
    "tags": [
        "logcollector_configuration"
    ],
    "name": "test_basic_configuration_ignore_binaries.py",
    "id": 1,
    "group_id": 0,
    "path": "tests/integration/test_logcollector/test_configuration/test_basic_configuration_ignore_binaries.py",
    "tests": [
        {
            "description": "Check if the 'wazuh-logcollector' daemon detects invalid configurations for the 'ignore_binaries' tag. For this purpose, the test will set a 'localfile' section using valid/invalid values for that tag. Then, it will check if an error event is generated when using an invalid value. Finally, the test will verify that the Wazuh API returns the same values for the 'localfile' section that the configured one.",
            "wazuh_min_version": "4.2.0",
            "parameters": [
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                }
            ],
            "assertions": [
                "Verify that the logcollector generates error events when using invalid values for the 'ignore_binaries' tag.",
                "Verify that the Wazuh API returns the same values for the 'localfile' section as the configured one."
            ],
            "input_description": "A configuration template (test_basic_configuration_ignore_binaries) is contained in an external YAML file (wazuh_basic_configuration.yaml). That template is combined with different test cases defined in the module. Those include configuration settings for the 'wazuh-logcollector' daemon.",
            "expected_output": [
                "r'Invalid value for element .*'",
                "r'Configuration error at .*'"
            ],
            "tags": [
                "invalid_settings"
            ],
            "name": "test_ignore_binaries"
        }
    ]
}

test_basic_configuration_label

Results

(testing-wazuh) reko@R98:~/repos/testing-wazuh$ qa-docs --tests-path  /home/reko/repos/testing-wazuh/PR2163/wazuh-qa/tests/integration/test_logcollector/ -t  test_basic_configuration_label
2022-01-10 12:45:20,895 - INFO - Looking for test_basic_configuration_label.py
2022-01-10 12:45:20,895 - INFO - Parsing the following test(s) ['test_basic_configuration_label']
2022-01-10 12:45:20,908 - INFO - Running QADOCS
2022-01-10 12:45:20,908 - INFO - Looking for test_basic_configuration_label.py
2022-01-10 12:45:21,076 - INFO - Run completed, documentation location: /tmp/qa_docs/output

Generated documentation

test_basic_configuration_label.json

{
    "copyright": "Copyright (C) 2015-2021, Wazuh Inc.\nCreated by Wazuh, Inc. <[email protected]>.\nThis program is free software; you can redistribute it and/or modify it under the terms of GPLv2",
    "type": "integration",
    "brief": "The 'wazuh-logcollector' daemon monitors configured files and commands for new log messages. Specifically, these tests will check if the Wazuh component (agent or manager) starts when the 'label' tag is set in the configuration, and the Wazuh API returns the same values for the configured 'localfile' section. Log data collection is the real-time process of making sense out of the records generated by servers or devices. This component can receive logs through text files or Windows event logs. It can also directly receive logs via remote syslog which is useful for firewalls and other such devices.",
    "tier": 0,
    "modules": [
        "logcollector"
    ],
    "components": [
        "agent",
        "manager"
    ],
    "daemons": [
        "wazuh-logcollector",
        "wazuh-apid"
    ],
    "os_platform": [
        "linux",
        "windows"
    ],
    "os_version": [
        "Arch Linux",
        "Amazon Linux 2",
        "Amazon Linux 1",
        "CentOS 8",
        "CentOS 7",
        "CentOS 6",
        "Ubuntu Focal",
        "Ubuntu Bionic",
        "Ubuntu Xenial",
        "Ubuntu Trusty",
        "Debian Buster",
        "Debian Stretch",
        "Debian Jessie",
        "Debian Wheezy",
        "Red Hat 8",
        "Red Hat 7",
        "Red Hat 6",
        "Windows 10",
        "Windows 8",
        "Windows 7",
        "Windows Server 2019",
        "Windows Server 2016",
        "Windows Server 2012",
        "Windows Server 2003",
        "Windows XP"
    ],
    "references": [
        "https://documentation.wazuh.com/current/user-manual/capabilities/log-data-collection/index.html",
        "https://documentation.wazuh.com/current/user-manual/reference/ossec-conf/localfile.html#label"
    ],
    "tags": [
        "logcollector_configuration"
    ],
    "name": "test_basic_configuration_label.py",
    "id": 1,
    "group_id": 0,
    "path": "tests/integration/test_logcollector/test_configuration/test_basic_configuration_label.py",
    "tests": [
        {
            "description": "Check if the 'wazuh-logcollector' daemon can monitor log files configured to use labels. For this purpose, the test will configure the logcollector to use labels, setting them in the label 'tag'. Once the logcollector has started, it will check if the 'analyzing' event, indicating that the testing log file is being monitored, has been generated. Finally, the test will verify that the Wazuh API returns the same values for the 'localfile' section that the configured one.",
            "wazuh_min_version": "4.2.0",
            "parameters": [
                {
                    "get_configuration": {
                        "type": "fixture",
                        "brief": "Get configurations from the module."
                    }
                },
                {
                    "configure_environment": {
                        "type": "fixture",
                        "brief": "Configure a custom environment for testing."
                    }
                },
                {
                    "restart_logcollector": {
                        "type": "fixture",
                        "brief": "Clear the 'ossec.log' file and start a new monitor."
                    }
                }
            ],
            "assertions": [
                "Verify that the logcollector monitors files when using the 'label' tag.",
                "Verify that the Wazuh API returns the same values for the 'localfile' section as the configured one."
            ],
            "input_description": "A configuration template (test_basic_configuration_label) is contained in an external YAML file (wazuh_basic_configuration.yaml). That template is combined with different test cases defined in the module. Those include configuration settings for the 'wazuh-logcollector' daemon.",
            "expected_output": [
                "r'Analyzing file.*'"
            ],
            "tags": [
                "invalid_settings",
                "logs"
            ],
            "name": "test_configuration_label"
        }
    ]
}

@snaow snaow merged commit 49cb99f into master Jan 27, 2022
@snaow snaow deleted the 1796-migrate-doc-logc-configuration-1 branch January 27, 2022 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

qa-docs: Migrate test_logcollector documentation to schema 2.0
5 participants