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

Journald support in Logcollector #12862

Open
12 of 13 tasks
DProvinciani opened this issue Mar 25, 2022 · 5 comments · Fixed by #23137
Open
12 of 13 tasks

Journald support in Logcollector #12862

DProvinciani opened this issue Mar 25, 2022 · 5 comments · Fixed by #23137
Assignees
Labels
level/objective module/logcollector qa_known Issues that are already known by the QA team type/enhancement New feature or request

Comments

@DProvinciani
Copy link
Contributor

DProvinciani commented Mar 25, 2022

Logcollector support for journald logs

EPIC branch
12862-logcollector-journald-support

Description

systemd has a component called journald that handles logging for the services. It makes it easier for the services to record information about their status and actions. This information can be very valuable for the Wazuh users, so we need to develop a way to enable Logcollector to monitor these logs.

Related issues

This task is similar to the support for macOS logs through the integration with the Unified Logging System:

Functional requirements

  1. The user will have a new option available in Logcollector to gather journald logs.
    • Local configuration: agent's etc/ossec.conf.
    • Shared configuration: manager's etc/shared/*/agent.conf.
    • Shared configuration: user interface.
  2. The user can define multiple <localfile> blocks for journald, all of which are valid.
  3. Agents will include a basic journald configuration by default, on new installations, if the platform has journald.
  4. Users will be provided with a predefined ruleset used to analyze journald events.
  5. Users may extend such ruleset according to their needs.
  6. The user will be able to find the alerts derived from the captured logs in the Wazuh Dashboard.

New options

<localfile>
  <log_format>journald</log_format>
  <journald>
    <priority>
    <transport>
    <syslog_identifier>
    <syslog_facility>

Compatible options

<localfile>
  <ignore>
  <restrict>
  <only-future-events>

Non-functional requirements

  1. Logcollector should check for new events in the journald API every logcollector.loop_timeout seconds.
  2. If logcollector.max_lines is greater than 0, then a maximum of events corresponding to the option value will be read in each read phase.
  3. If <only-future-events> is set to no, the agent shall position the read cursor over the event after the last one sent after a restart.
  4. If either <only-future-events> is set to yes, or the agent has started for the first time, the agent should position the read cursor at the end of the log.
  5. Options <ignore> and <restrict> shall execute the search on the content to be sent (full log).
  6. The documentation shall include a new capabilities section explaining how to gather journald logs.

Implementation restrictions

  1. The content that the agent sends (full_log) must correspond to the output of journalctl.
  2. This feature should be implemented via the journald API. Avoid calling journalctl whenever possible.
  3. This feature will only be available on Linux, and depends on the distro being based on systemd.
  4. Regarding functional requirement no. 2, there is no way to override or cancel a journald <localfile> block.

Plan

Requirements Traceability Matrix (RTM)

Requirement type Responsible Description Plan part
Functional @wazuh/core New option in Logcollector. Stages 2 & 4
Functional @wazuh/core Accept multiple settings. Stage 2
Functional @wazuh/core Include a basic default configuration. Stage 2
Functional @wazuh/threat-intel Define a default ruleset. Stage 5
Functional @wazuh/threat-intel Accept ruleset extensions. Stage 5
Functional @wazuh/frontend Ability to find alerts in the Dashboard. Stage 6
Functional @wazuh/framework Parse and send journald Configuration as JSON. Stage 8
Non-functional @wazuh/core Regularly pick events from journald. Stage 2
Non-functional @wazuh/core Limit read to a maximum event count. Stage 2
Non-functional @wazuh/core Set the read cursor in the previous position before restarting. Stage 2
Non-functional @wazuh/core Set the read cursor at the end, according to the configuration. Stage 2
Non-functional @wazuh/core Implement behavior for <ignore> and <restrict>. Stage 2
Non-functional @wazuh/content Extend the documentation's capabilities section. Stage 7
Implementation restriction @wazuh/core The full log must match the journald output. Stage 2
Implementation restriction @wazuh/core Use the journald API. Stage 2
Implementation restriction @wazuh/core Availability restricted to Linux with systemd. Stage 2
Implementation restriction @wazuh/core Do not support setting overriding or cancelation. Stage 2

Reference

Approved by

@sempervictus
Copy link

I did this for OSSEC a few years back - just haven't had the time/energy to port it over. I spoke with the devs in Slack about this and they said they were looking into doing the portage to Wazuh. If anyone else wants to rewrite a bunch of pointer syntax to convert the OSSEC modality to the way Wazuh modified the C code for the internal logreader pipeline, feel free to ping me for assistance.

@nnachefski
Copy link

I'm using a custom-built wazuh container that runs as a DaemonSet on OKD worker nodes (Fedora CoreOS). Fedora uses a journald logging systems. I need wazuh to be able to parse journald logs (instead of log files) for this to work. Any idea on when this will enter the roadmap? Journald has been around for some time already (10 years?!).

@branchnetconsulting
Copy link
Contributor

I just had a client today asking me if Wazuh could logcollect directly from journald and I pointed him here. If there there is more info available on this please do share.

@mauromalara mauromalara added the qa_known Issues that are already known by the QA team label Aug 31, 2023
This was referenced Oct 3, 2023
@havidarou havidarou changed the title Implement the support for journald logs in logcollector Journald support in Logcollector Jan 16, 2024
@havidarou havidarou removed the epic label Jan 16, 2024
@vikman90
Copy link
Member

vikman90 commented Apr 4, 2024

We agree to delay the task delivery to April 18th.

@V3ntus
Copy link

V3ntus commented Apr 17, 2024

Echoing interest. The Nix community is progressively porting the Wazuh suite to NixOS and Nixpkgs, but this means Wazuh LogCollector on NixOS will not work without journald support (see Logging in the NixOS manual)

Porting progress: NixOS/nixpkgs#230623

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/objective module/logcollector qa_known Issues that are already known by the QA team type/enhancement New feature or request
Projects
Status: In progress
Status: In progress
Development

Successfully merging a pull request may close this issue.

10 participants