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

Allow specifying alternate journal fields #1810

Merged
merged 1 commit into from
Sep 26, 2024

Conversation

cyrus-mc
Copy link
Contributor

PR for issue #1809.

This changes the semantics of field systemdFilter to allow specifying a journal field. If none is specified, the behavior reverts to the default of assuming _SYSTEMD_UNIT.

@cyrus-mc cyrus-mc force-pushed the add_systemd_journal_field branch from ff75946 to 79775db Compare September 18, 2024 22:25
@pepov
Copy link
Member

pepov commented Sep 24, 2024

@cyrus-mc can you add a simple example to the PR description please?

@cyrus-mc
Copy link
Contributor Author

@pepov Here you go

apiVersion: logging-extensions.banzaicloud.io/v1alpha1
kind: HostTailer
metadata:
  labels:
    app.kubernetes.io/name: systemd-hosttailer
  name: systemd
  namespace: logging
spec:
  systemdTailers:
  - maxEntries: 100
    name: kubelet
    systemdFilter: kubelet.service
  - maxEntries: 100
    name: kernel
    systemdFilter: SYSLOG_IDENTIFIER=kernel

Here I am creating a systemd tailer for the kubelet.service as well as kernel logs, which are logged under journal field SYSLOG_IDENTIFIER.

This will generate a container with arguments:

      - command:
        - /fluent-bit/bin/fluent-bit
        - -i
        - systemd
        - -p
        - path=/var/log/journal
        - -p
        - db=/var/pos/systemd-host-tailer-kernel.db
        - -p
        - max_entries=100
        - -p
        - systemd_filter=SYSLOG_IDENTIFIER=kernel
        - -o
        - file
        - -p
        - format=plain
        - -p
        - path=/dev/
        - -p
        - file=stdout

@pepov pepov added the enhancement New feature or request label Sep 26, 2024
@pepov
Copy link
Member

pepov commented Sep 26, 2024

thanks @cyrus-mc !

@pepov pepov self-requested a review September 26, 2024 13:20
@pepov pepov merged commit 7ee56d0 into kube-logging:master Sep 26, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants