522 iocage templates ansible-syslogng-*

Use case

Configure and run a log server. Configure log clients and test them. Use syslog-ng. Create templates ansible-syslogng-server and ansible-syslogng-client. Create the jails from the templates.

Quoting syslog-ng - FreeBSD Wiki:

“One of the most typical use of syslog-ng is central log aggregation. … It collects log messages on TCP port 514 and saves them to directories and files based on sender host name and current date.”

Tree

shell > tree .
.
├── ansible.cfg
├── files
│   ├── pkgs-logclient.json
│   └── pkgs-logserver.json
├── group_vars
│   └── all
│       ├── common.yml
│       └── project-hosts.yml
├── hosts
│   └── 06_iocage2.yml
├── host_vars
│   ├── ansible_syslogng_client
│   │   └── syslog-ng-client.yml
│   ├── ansible_syslogng_server
│   │   └── syslog-ng-server.yml
│   └── iocage_06
│       └── template.yml
├── iocage.ini
├── pb-create-jails.yml
├── pb-iocage-template-stop-convert.yml
├── pb-iocage-template.yml
├── pb-logclient-test.yml
├── pb-logclient.yml
├── pb-logserver-test.yml
└── pb-logserver.yml

Synopsis

  • At a managed node:

    Use the role vbotka.freebsd.iocage_template to create templates:

    • ansible-syslogng-server

    • ansible-syslogng-client

    In the playbook pb-create-jails.yml:

    • Create jails from the created templates

  • In the inventory group log_servers configure and test syslog-ng server.

  • In the inventory group log_clients configure and test syslog-ng client.

Requirements

Note

ansible.cfg

[defaults]
callback_result_format = yaml
deprecation_warnings = false
display_skipped_hosts = false
gathering = explicit
interpreter_python = auto_silent
log_path = /var/log/ansible.log

[connection]
pipelining = true

Inventory iocage.ini

iocage_06

[iocage]
iocage_06

[iocage:vars]
ansible_user=admin
ansible_become=true
ansible_python_interpreter=auto_silent

hosts

hosts/06_iocage2.yml
plugin: vbotka.freebsd.iocage2
host: iocage_06
user: admin
sudo: true
get_properties: true
inventory_hostname_tag: alias

compose:
  iocage_tags: dict(iocage_properties.notes | regex_findall('(\w+)=([\w\-]+)'))
  iocage_classes: iocage_properties.notes | regex_findall('(?<=class=)[\w\-]+|(?<=,)[\w\-]+')
# connection plugin vbotka.freebsd.jailexec
  ansible_connection: "'vbotka.freebsd.jailexec'"
  ansible_ssh_user: "'admin'"
  ansible_jail_host: dict(iocage_properties.notes | regex_findall('(\w+)=([\w\-]+)')).vmm | d('none')
  ansible_jail_name: iocage_jid
  ansible_jail_privilege_escalation: "'sudo'"
# ansible options
  ansible_python_interpreter: "'auto_silent'"

groups:
  log_servers: iocage_classes is contains('log-server')
  log_clients: iocage_classes is contains('log-client')

keyed_groups:
  - prefix: state
    key: iocage_state
  - prefix: vmm
    key: iocage_tags.vmm

group_vars

group_vars/all/common.yml
ansible_python_interpreter: auto_silent
group_vars/all/project-hosts.yml
project_hosts:
  iocage_06:
    defaultrouter: 172.16.99.1 
    log_server: 172.16.99.10
    # repositories
    repos: 172.16.99.21
    repos_devel: 172.16.99.22
    # plugins
    ansible_pull_syslogng_server: 172.16.99.31
    # templates
    ansible_syslogng_server: 172.16.99.41

host_vars

host_vars/ansible_syslogng_client/syslog-ng-client.yml
fp_syslogd: true
fp_syslogd_enable: false
fp_syslogd_conf_sanity: false

fp_syslogng: true
fp_syslogng_enable: true
fp_syslogng_conf_template: syslog-ng.conf.j2
fp_syslogng_conf:
  header:
    - '@version:4.8'
    - '@include "scl.conf"'
  options:
    - threaded(yes)
    - group("wheel")
    - perm(0640)
  source:
    s_system:
      - unix-dgram("/var/run/log")
      - unix-dgram("/var/run/logpriv" perm(0600))
      - internal()
    s_ansible:
      - file("/var/log/ansible.log" follow-freq(1) program-override("ansible"))
  destination:
    d_network:
      - network("{{ project_hosts[iocage_tags.vmm]['log_server'] }}" port(514) transport("tcp"))
  filter:
    f_messages:
      - level(info..emerg) and not facility(auth, authpriv, lpr, mail, news, daemon)
    f_daemon:
      - facility(daemon)
  log:
    - source: s_system
      filter: f_daemon
      destination: d_network
    - source: s_system
      filter: f_messages
      destination: d_network
    - source: s_ansible
      destination: d_network
host_vars/ansible_syslogng_server/syslog-ng-server.yml
fp_syslogd: true
fp_syslogd_enable: false
fp_syslogd_conf_sanity: false

fp_syslogng: true
fp_syslogng_enable: true
fp_syslogng_conf_template: syslog-ng.conf.j2
fp_syslogng_conf:
  header:
    - '@version:4.8'
    - '@include "scl.conf"'
  options:
    - threaded(yes)
    - group("wheel")
    - perm(0640)
  source:
    s_system:
      - unix-dgram("/var/run/log")
      - unix-dgram("/var/run/logpriv" perm(0600))
      - internal()
    s_ansible:
      - file("/var/log/ansible.log" follow-freq(1) program-override("ansible"))
    s_remote:
      - tcp(port(514))
  destination:
    d_local:
      - file("/var/log/remote/${HOST}/${YEAR}_${MONTH}_${DAY}.log" create-dirs(yes))
  filter:
    f_messages:
      - level(notice..emerg) and not facility(auth, authpriv, lpr, mail, news, daemon)
    f_daemon:
      - facility(daemon)
  log:
    - source: s_remote
      destination: d_local
    - source: s_system
      filter: f_daemon
      destination: d_local
    - source: s_system
      filter: f_messages
      destination: d_local
    - source: s_ansible
      destination: d_local
host_vars/iocage_06/template.yml
fit_templates:
  ansible-syslogng-server:
    release: 15.1-RELEASE
    pkglist: /tmp/ansible/ansible-syslogng-server/pkgs-logserver.json
    properties:
      ip4: disable
      ip6: disable
      ip6_addr: none
      boot: 0
      defaultrouter: "{{ project_hosts[inventory_hostname]['defaultrouter'] }}"
      ip4_addr: "vnet0|{{ project_hosts[inventory_hostname]['ansible_syslogng_server'] }}/24"
      vnet: 1
      notes: '"vmm={{ inventory_hostname }} alias=ansible_syslogng_server"'
  ansible-syslogng-client:
    release: 15.1-RELEASE
    pkglist: /tmp/ansible/ansible-syslogng-client/pkgs-logclient.json
    properties:
      ip4: disable
      ip6: disable
      ip6_addr: none
      boot: 0
      bpf: 1
      dhcp: 1
      vnet: 1
      notes: '"vmm={{ inventory_hostname }} alias=ansible_syslogng_client"'

# Do not stop jails. Configure them first. Then stop and convert them to templates.
fit_stop: false
fit_template: false
      
log_server_properties:
  ip4: disable
  ip6: disable
  ip6_addr: none
  boot: 1
  defaultrouter: "{{ project_hosts[inventory_hostname]['defaultrouter'] }}"
  ip4_addr: "vnet0|{{ project_hosts[inventory_hostname]['log_server'] }}/24"
  vnet: 1

log_client_properties:
  ip4: disable
  ip6: disable
  ip6_addr: none
  boot: 1
  bpf: 1
  dhcp: 1
  vnet: 1

log_clients:
  - foo
  - bar

files

files/pkgs-logclient.json
{
    "pkgs": [
	"sudo",
	"syslog-ng"
        ]
}
files/pkgs-logserver.json
{
    "pkgs": [
        "lnav",
	"sudo",
	"syslog-ng"
        ]
}

Playbook pb-iocage-template.yml

---
- name: Create iocage templates.
  hosts: iocage

  roles:

    - vbotka.freebsd.iocage_template

Playbook output - Create iocage templates

(env) > ansible-playbook -i iocage.ini pb-iocage-template.yml
PLAY [Create iocage templates.] ************************************************

TASK [vbotka.freebsd.iocage_template : Setup: Get iocage list of templates.] ***
ok: [iocage_06]

TASK [vbotka.freebsd.iocage_template : Setup: All templates already created.] ***
ok: [iocage_06] => 
    msg: All templates already created. End host.

PLAY RECAP *********************************************************************
iocage_06                  : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

Playbook pb-logserver.yml

---
- name: Configure and start Log Server.
  hosts: ansible_syslogng_server
    
  tasks:

    - name: Stop and disable syslogd
      ansible.builtin.import_role:
        name: vbotka.freebsd.postinstall
        tasks_from: syslogd.yml

    - name: Configure and start syslog-ng
      ansible.builtin.import_role:
        name: vbotka.freebsd.postinstall
        tasks_from: syslog-ng.yml

Playbook output - Configure and start Log Server

(env) > ansible-playbook -i hosts pb-logserver.yml
PLAY [Configure and start Log Server.] *****************************************
skipping: no hosts matched

PLAY RECAP *********************************************************************

Playbook pb-logclient.yml

---
- name: Configure Log Client.
  hosts: ansible_syslogng_client
    
  tasks:

    - name: Stop and disable syslogd
      ansible.builtin.import_role:
        name: vbotka.freebsd.postinstall
        tasks_from: syslogd.yml

    - name: Configure syslog-ng
      ansible.builtin.import_role:
        name: vbotka.freebsd.postinstall
        tasks_from: syslog-ng.yml

Playbook output - Configure and start Log Client

(env) > ansible-playbook -i hosts pb-logclient.yml
PLAY [Configure Log Client.] ***************************************************
skipping: no hosts matched

PLAY RECAP *********************************************************************

Playbook pb-iocage-template-stop-convert.yml

---
- name: Stop and convert ansible-syslogng-* to templates.
  hosts: iocage

  vars:

    iocage_jails: "{{ out.stdout | vbotka.freebsd.iocage('jails') }}"

  tasks:

    - name: Get iocage list of jails.
      register: out
      changed_when: false
      ansible.builtin.command: iocage list --long

    - name: Stop ansible-syslogng-server and convert it to template.
      when: iocage_jails is contains('ansible-syslogng-server')
      block:

        - name: Stop ansible-syslogng-server
          ansible.builtin.command: iocage stop ansible-syslogng-server

        - name: Convert ansible-syslogng-server jail to template.
          ansible.builtin.command: iocage set template=1 ansible-syslogng-server

    - name: Stop ansible-syslogng-client and convert it to template.
      when: iocage_jails is contains('ansible-syslogng-client')
      block:

        - name: Stop ansible-syslogng-client
          ansible.builtin.command: iocage stop ansible-syslogng-client

        - name: Convert ansible-syslogng-client jail to template.
          ansible.builtin.command: iocage set template=1 ansible-syslogng-client

Playbook output - Convert ansible-syslogng-* to templates

(env) > ansible-playbook -i iocage.ini pb-iocage-template-stop-convert.yml
PLAY [Stop and convert ansible-syslogng-* to templates.] ***********************

TASK [Get iocage list of jails.] ***********************************************
ok: [iocage_06]

PLAY RECAP *********************************************************************
iocage_06                  : ok=1    changed=0    unreachable=0    failed=0    skipped=4    rescued=0    ignored=0   

List templates

shell > ssh admin@iocage_06 sudo iocage list -lt
+------+-------------------------+------+-------+----------+-----------------+-----------------------+-----+----------+----------+
| JID  |          NAME           | BOOT | STATE |   TYPE   |     RELEASE     |          IP4          | IP6 | TEMPLATE | BASEJAIL |
+======+=========================+======+=======+==========+=================+=======================+=====+==========+==========+
| None | ansible-client          | off  | down  | template | 15.1-RELEASE-p1 | DHCP (not running)    | -   | -        | no       |
+------+-------------------------+------+-------+----------+-----------------+-----------------------+-----+----------+----------+
| None | ansible-client-apache   | off  | down  | template | 15.1-RELEASE-p1 | DHCP (not running)    | -   | -        | no       |
+------+-------------------------+------+-------+----------+-----------------+-----------------------+-----+----------+----------+
| None | ansible-client-pull     | off  | down  | template | 15.1-RELEASE-p1 | DHCP (not running)    | -   | -        | no       |
+------+-------------------------+------+-------+----------+-----------------+-----------------------+-----+----------+----------+
| None | ansible-init            | off  | down  | template | 15.1-RELEASE-p1 | DHCP (not running)    | -   | -        | no       |
+------+-------------------------+------+-------+----------+-----------------+-----------------------+-----+----------+----------+
| None | ansible-init-devel      | off  | down  | template | 15.1-RELEASE-p1 | DHCP (not running)    | -   | -        | no       |
+------+-------------------------+------+-------+----------+-----------------+-----------------------+-----+----------+----------+
| None | ansible-init-example    | off  | down  | template | 15.1-RELEASE-p1 | DHCP (not running)    | -   | -        | no       |
+------+-------------------------+------+-------+----------+-----------------+-----------------------+-----+----------+----------+
| None | ansible-nginx           | off  | down  | template | 15.1-RELEASE-p1 | DHCP (not running)    | -   | -        | no       |
+------+-------------------------+------+-------+----------+-----------------+-----------------------+-----+----------+----------+
| None | ansible-pkg-repo        | off  | down  | template | 15.1-RELEASE-p1 | DHCP (not running)    | -   | -        | no       |
+------+-------------------------+------+-------+----------+-----------------+-----------------------+-----+----------+----------+
| None | ansible-repos           | off  | down  | template | 15.1-RELEASE-p1 | DHCP (not running)    | -   | -        | no       |
+------+-------------------------+------+-------+----------+-----------------+-----------------------+-----+----------+----------+
| None | ansible-syslogng-client | off  | down  | template | 15.1-RELEASE-p1 | DHCP (not running)    | -   | -        | no       |
+------+-------------------------+------+-------+----------+-----------------+-----------------------+-----+----------+----------+
| None | ansible-syslogng-server | off  | down  | template | 15.1-RELEASE-p1 | vnet0|172.16.99.41/24 | -   | -        | no       |
+------+-------------------------+------+-------+----------+-----------------+-----------------------+-----+----------+----------+

Playbook pb-create-jails.yml

---
- name: Create jails from iocage templates.
  hosts: iocage

  vars:

    client_exist: "{{ groups.all | intersect(log_clients) }}"

  tasks:

    - name: log_client exist.
      when: client_exist | length > 0
      block:

        - name: Assert log_client is in groups.log_clients
          vars:
            missing: "{{ client_exist | difference(groups.log_clients | d([])) }}"
          ansible.builtin.assert:
            that: missing | length == 0
            fail_msg: "[ERR] {{ missing | join(', ') }} not in group log_clients"
            quiet: true

        - name: Display message.
          ansible.builtin.debug:
            msg: "[INFO] {{ client_exist | join(', ') }} exist(s)."

    - name: Create log_clients
      vars:
        _notes: >
          "vmm={{ inventory_hostname }}
          class=log-client
          alias={{ item | replace('-', '_') }}"
        _properties: >-
          {% for k, v in log_client_properties.items() %}
          {{ k }}={{ v }}
          {% endfor %}
          notes={{ _notes }}
      ansible.builtin.command: >
        iocage create
        --name {{ item }}
        --template ansible-syslogng-client
        {{ _properties }}
      loop: "{{ log_clients | difference(client_exist) }}"

    - name: End of host if log_server exists.
      when: groups.all is contains('log_server')
      block:

        - name: Assert log_server is in groups.log_servers
          ansible.builtin.assert:
            that: groups.log_servers | d([]) is contains('log_server')
            fail_msg: '[ERR] log_server not in groups.log_servers'
            quiet: true

        - name: Display message.
          ansible.builtin.debug:
            msg: '[INFO] log_server exists.'

        - name: End of host.
          ansible.builtin.meta: end_host

    - name: Create log_server
      vars:
        _notes: >
          "vmm={{ inventory_hostname }}
          class=log-server
          alias=log_server"
        _properties: >-
          {% for k, v in log_server_properties.items() %}
          {{ k }}={{ v }}
          {% endfor %}
          notes={{ _notes }}
      ansible.builtin.command: >
        iocage create
        --name log-server
        --template ansible-syslogng-server
        {{ _properties }}

Playbook output - Create jails from iocage templates

(env) > ansible-playbook -i iocage.ini -i hosts pb-create-jails.yml.yml
PLAY [Create jails from iocage templates.] *************************************

TASK [Create log_clients] ******************************************************
changed: [iocage_06] => (item=foo)
changed: [iocage_06] => (item=bar)

TASK [Create log_server] *******************************************************
changed: [iocage_06]

PLAY RECAP *********************************************************************
iocage_06                  : ok=2    changed=2    unreachable=0    failed=0    skipped=4    rescued=0    ignored=0   

Inventory graph

shell > ansible-inventory -i hosts --graph
@all:
  |--@ungrouped:
  |--@state_up:
  |  |--repos
  |  |--test_153
  |  |--log_server
  |  |--repos_devel
  |  |--foo
  |  |--pkg_repo
  |  |--www_02
  |  |--bar
  |  |--test_152
  |  |--www_01
  |  |--test_151
  |--@vmm_iocage_06:
  |  |--repos
  |  |--test_153
  |  |--log_server
  |  |--db1
  |  |--repos_devel
  |  |--db2
  |  |--foo
  |  |--pkg_repo
  |  |--www_02
  |  |--bar
  |  |--test_152
  |  |--www_01
  |  |--test_151
  |--@log_servers:
  |  |--log_server
  |--@state_down:
  |  |--db1
  |  |--db2
  |--@log_clients:
  |  |--foo
  |  |--www_02
  |  |--bar
  |  |--www_01

List jails

shell > ssh admin@iocage_06 sudo iocage list -l
+------+-------------+------+-------+------+-----------------+-----------------------+-----+-------------------------+----------+
| JID  |    NAME     | BOOT | STATE | TYPE |     RELEASE     |          IP4          | IP6 |        TEMPLATE         | BASEJAIL |
+======+=============+======+=======+======+=================+=======================+=====+=========================+==========+
| None | 09caf271    | off  | down  | jail | 15.1-RELEASE-p1 | DHCP (not running)    | -   | -                       | no       |
+------+-------------+------+-------+------+-----------------+-----------------------+-----+-------------------------+----------+
| None | 1718af82    | off  | down  | jail | 15.1-RELEASE-p1 | DHCP (not running)    | -   | -                       | no       |
+------+-------------+------+-------+------+-----------------+-----------------------+-----+-------------------------+----------+
| 30   | bar         | on   | up    | jail | 15.1-RELEASE-p1 | epair0b|172.16.99.143 | -   | ansible-syslogng-client | no       |
+------+-------------+------+-------+------+-----------------+-----------------------+-----+-------------------------+----------+
| 29   | foo         | on   | up    | jail | 15.1-RELEASE-p1 | epair0b|172.16.99.138 | -   | ansible-syslogng-client | no       |
+------+-------------+------+-------+------+-----------------+-----------------------+-----+-------------------------+----------+
| 31   | log-server  | on   | up    | jail | 15.1-RELEASE-p1 | vnet0|172.16.99.10/24 | -   | ansible-syslogng-server | no       |
+------+-------------+------+-------+------+-----------------+-----------------------+-----+-------------------------+----------+
| 21   | pkg-repo    | on   | up    | jail | 15.1-RELEASE-p1 | vnet0|172.16.99.23/24 | -   | ansible-pkg-repo        | no       |
+------+-------------+------+-------+------+-----------------+-----------------------+-----+-------------------------+----------+
| 18   | repos       | on   | up    | jail | 15.1-RELEASE-p1 | vnet0|172.16.99.21/24 | -   | ansible-repos           | no       |
+------+-------------+------+-------+------+-----------------+-----------------------+-----+-------------------------+----------+
| 19   | repos-devel | on   | up    | jail | 15.1-RELEASE-p1 | vnet0|172.16.99.22/24 | -   | ansible-repos           | no       |
+------+-------------+------+-------+------+-----------------+-----------------------+-----+-------------------------+----------+
| 28   | test-151    | off  | up    | jail | 15.1-RELEASE-p1 | epair0b|172.16.99.189 | -   | ansible-client          | no       |
+------+-------------+------+-------+------+-----------------+-----------------------+-----+-------------------------+----------+
| 27   | test-152    | off  | up    | jail | 15.1-RELEASE-p1 | epair0b|172.16.99.188 | -   | ansible-client          | no       |
+------+-------------+------+-------+------+-----------------+-----------------------+-----+-------------------------+----------+
| 26   | test-153    | off  | up    | jail | 15.1-RELEASE-p1 | epair0b|172.16.99.187 | -   | ansible-client          | no       |
+------+-------------+------+-------+------+-----------------+-----------------------+-----+-------------------------+----------+
| 23   | www-01      | on   | up    | jail | 15.1-RELEASE-p1 | epair0b|172.16.99.116 | -   | ansible-init            | no       |
+------+-------------+------+-------+------+-----------------+-----------------------+-----+-------------------------+----------+
| 24   | www-02      | on   | up    | jail | 15.1-RELEASE-p1 | epair0b|172.16.99.147 | -   | ansible-init            | no       |
+------+-------------+------+-------+------+-----------------+-----------------------+-----+-------------------------+----------+

Playbook pb-logserver-test.yml

---
- name: Test Log Server.
  hosts: log_servers
    
  tasks:

    - name: Run commands.
      register: out
      ansible.builtin.shell: "{{ item }}"
      loop:
        - rm -rf /var/log/remote/localhost/*
        - service syslog-ng status
        - loggen -i -S -n 1 localhost 514
        - sleep 5; find /var/log/remote/localhost/ -name *.log | xargs cat

    - name: Debug.
      when: debug | d(false) | bool
      ansible.builtin.debug:
        msg: |
          {% for i in out.results %}
          shell> {{ i.item }}
          {% if i.stdout | length > 0 %}
          {{ i.stdout }}
          {% endif %}
          {% if i.stderr | length > 0 %}
          {{ i.stderr }}
          {% endif %}

          {% endfor %}

Playbook output - Test Log Server

(env) > ansible-playbook -i hosts -e debug=true pb-logserver-test.yml
PLAY [Test Log Server.] ********************************************************

TASK [Run commands.] ***********************************************************
changed: [log_server] => (item=rm -rf /var/log/remote/localhost/*)
changed: [log_server] => (item=service syslog-ng status)
changed: [log_server] => (item=loggen -i -S -n 1 localhost 514)
changed: [log_server] => (item=sleep 5; find /var/log/remote/localhost/ -name *.log | xargs cat)

TASK [Debug.] ******************************************************************
ok: [log_server] => 
    msg: |-
        shell> rm -rf /var/log/remote/localhost/*

        shell> service syslog-ng status
        syslog_ng is running as pid 61179.

        shell> loggen -i -S -n 1 localhost 514
        count=1, rate = 90909.09 msg/sec
        average rate = 2.00 msg/sec, count=1, time=0.5001, (average) msg size=256, bandwidth=0.50 kB/sec

        shell> sleep 5; find /var/log/remote/localhost/ -name *.log | xargs cat

PLAY RECAP *********************************************************************
log_server                 : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

Playbook pb-logclient-test.yml

---
- name: Test Log Clients.
  hosts: log_clients

  vars:

    log_server: "{{ hostvars['log_server']['iocage_ip4'] }}"

  tasks:

    - name: Run loggen
      register: out
      ansible.builtin.command: "loggen -i -S -n 1 {{ log_server }} 514"

    - name: Debug.
      ansible.builtin.debug:
        var: out.stderr

- name: Display the logs.
  hosts: log_server
    
  tasks:

    - name: Get log files paths.
      register: out
      ansible.builtin.find:
        paths: /var/log/remote
        recurse: true
        patterns: '*.log'

    - name: Get log files.
      register: out
      ansible.builtin.command: "cat {{ item }}"
      loop: "{{ out.files | map(attribute='path') }}"

    - name: Display log files.
      ansible.builtin.debug:
        msg: |
          {{ item.stdout }}

          - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      loop: "{{ out.results }}"
      loop_control:
        label: "{{ item.cmd }}"

Playbook output - Test Log Clients

(env) > ansible-playbook -i hosts pb-logclient-test.yml
PLAY [Test Log Clients.] *******************************************************

TASK [Run loggen] **************************************************************
changed: [www_02]
changed: [bar]
changed: [foo]
changed: [www_01]

TASK [Debug.] ******************************************************************
ok: [www_02] => 
    out.stderr: |-
        count=1, rate = 33333.33 msg/sec
        average rate = 2.00 msg/sec, count=1, time=0.50015, (average) msg size=256, bandwidth=0.50 kB/sec
ok: [foo] => 
    out.stderr: |-
        count=1, rate = 333333.33 msg/sec
        average rate = 2.00 msg/sec, count=1, time=0.500218, (average) msg size=256, bandwidth=0.50 kB/sec
ok: [bar] => 
    out.stderr: |-
        count=1, rate = 333333.33 msg/sec
        average rate = 2.00 msg/sec, count=1, time=0.500234, (average) msg size=256, bandwidth=0.50 kB/sec
ok: [www_01] => 
    out.stderr: |-
        count=1, rate = 200000.00 msg/sec
        average rate = 2.00 msg/sec, count=1, time=0.500146, (average) msg size=256, bandwidth=0.50 kB/sec

PLAY [Display the logs.] *******************************************************

TASK [Get log files paths.] ****************************************************
ok: [log_server]

TASK [Get log files.] **********************************************************
changed: [log_server] => (item=/var/log/remote/ip-172-16-99-138/2026_08_27.log)
changed: [log_server] => (item=/var/log/remote/ip-172-16-99-143/2026_08_27.log)
changed: [log_server] => (item=/var/log/remote/ip-172-16-99-147/2026_08_27.log)
changed: [log_server] => (item=/var/log/remote/ip-172-16-99-116/2026_08_27.log)

TASK [Display log files.] ******************************************************
ok: [log_server] => (item=['cat', '/var/log/remote/ip-172-16-99-138/2026_08_27.log']) => 
    msg: |-
        Aug 27 11:36:54 ip-172-16-99-138 prg00000[1234]: seq: 0000000000, thread: 0000, runid: 1787823414, stamp: 2026-08-27T11:36:54 PADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADD

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ok: [log_server] => (item=['cat', '/var/log/remote/ip-172-16-99-143/2026_08_27.log']) => 
    msg: |-
        Aug 27 11:36:54 ip-172-16-99-143 prg00000[1234]: seq: 0000000000, thread: 0000, runid: 1787823414, stamp: 2026-08-27T11:36:54 PADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADD

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ok: [log_server] => (item=['cat', '/var/log/remote/ip-172-16-99-147/2026_08_27.log']) => 
    msg: |-
        Aug 27 11:36:54 ip-172-16-99-147 prg00000[1234]: seq: 0000000000, thread: 0000, runid: 1787823414, stamp: 2026-08-27T11:36:54 PADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADD

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ok: [log_server] => (item=['cat', '/var/log/remote/ip-172-16-99-116/2026_08_27.log']) => 
    msg: |-
        Aug 27 11:36:54 ip-172-16-99-116 prg00000[1234]: seq: 0000000000, thread: 0000, runid: 1787823414, stamp: 2026-08-27T11:36:54 PADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADDPADD

        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

PLAY RECAP *********************************************************************
bar                        : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
foo                        : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
log_server                 : ok=3    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
www_01                     : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
www_02                     : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   

Hint

Use lnav utility on the log server to display all logfiles in the the directory /var/log/remote:

shell > iocage console log-server
root@log-server:~ # lnav -r /var/log/remote/