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 · 7 comments · May be fixed by #9837
Open

Change systemd execstart to yml conf #9714

P4R4DiSi4C opened this issue Dec 11, 2024 · 7 comments · May be fixed by #9837

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@/@[email protected]
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 :)

@patrick-stephens
Copy link
Contributor

@edsiper I think we should consider this for 4.0, main thing is to ensure we notify people so they can expect it.

See https://fluent-all.slack.com/archives/C0CTQGHKJ/p1736719725842959 as well.

@patrick-stephens patrick-stephens linked a pull request Jan 15, 2025 that will close this issue
7 tasks
@patrick-stephens
Copy link
Contributor

patrick-stephens commented Jan 15, 2025

I've prepped a PR for this: #9837

Note there are a few more places to update and missing files to add, my PR covers all targets and adds them.

@Elwell
Copy link

Elwell commented Jan 15, 2025

Minor typo for @P4R4DiSi4C's benefit - you can drop the double slash in the ExecStart (it's a typo upstream too) so it should be

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

or .yaml depending on preferences :-)

@P4R4DiSi4C
Copy link
Author

Minor typo for @P4R4DiSi4C's benefit - you can drop the double slash in the ExecStart (it's a typo upstream too) so it should be

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

or .yaml depending on preferences :-)

Thanks for that @Elwell !

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

Successfully merging a pull request may close this issue.

4 participants