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

Change systemd execstart to yml conf #9714

Open
P4R4DiSi4C opened this issue Dec 11, 2024 · 3 comments
Open

Change systemd execstart to yml conf #9714

P4R4DiSi4C opened this issue Dec 11, 2024 · 3 comments

Comments

@P4R4DiSi4C
Copy link

Currently, '.conf' is hardcoded in the following file: https://github.com/fluent/fluent-bit/blob/master/init/systemd.in
Is there any plan to change it to '.yml' so we avoid the need of overriding the systemd configuration ?

[Unit]
Description=@FLB_PROG_NAME@
Documentation=https://docs.fluentbit.io/manual/
Requires=network.target
After=network.target

[Service]
Type=simple
EnvironmentFile=-/etc/sysconfig/@FLB_OUT_NAME@
EnvironmentFile=-/etc/default/@FLB_OUT_NAME@
ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/@FLB_OUT_NAME@ -c /@CMAKE_INSTALL_SYSCONFDIR@/@FLB_OUT_NAME@/@FLB_OUT_NAME@.conf
Restart=always

[Install]
WantedBy=multi-user.target
@patrick-stephens
Copy link
Contributor

Yes although we will have to be careful of impact on existing users who may be relying on overriding the conf file. It would have to be documented explicitly and maybe as a breaking change e.g. in 4.0 release @edsiper ?

YAML format was only completed for 3.2 as well so previous versions are still supported.

@chadmyers
Copy link

@P4R4DiSi4C How do you override the system configuration to use yaml?

@P4R4DiSi4C
Copy link
Author

@P4R4DiSi4C How do you override the system configuration to use yaml?

I have the following Ansible task:

  ansible.builtin.template:
    src: fluent-bit-override.conf.j2
    dest: "/etc/systemd/system/fluent-bit.service.d/override.conf"
    mode: '0644'
  when: fluentbit_systemd_override is defined

With the following template:

{{ ansible_managed | comment }}

[Service]
{% for key, value in fluentbit_systemd_override.items() %}
{% if key == 'ExecStart' %}
{{ key }}=
{% endif %}
{{ key }}={{ value }}
{% endfor %}

And set the following value:

fluentbit_systemd_override:
  ExecStart: '/opt/fluent-bit/bin/fluent-bit -c //etc/fluent-bit/fluent-bit.yml'

Which results in a override.conf file being created in the folder /etc/systemd/system/fluent-bit.service.d/ with the following content:

#
# Ansible managed
#

[Service]
ExecStart=
ExecStart=/opt/fluent-bit/bin/fluent-bit -c //etc/fluent-bit/fluent-bit.yml

Hope it helps :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants