Skip to content

Change systemd execstart to yml conf #9714

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Change systemd execstart to yml conf #9714

P4R4DiSi4C opened this issue Dec 11, 2024 · 9 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@/@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 :)

@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
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 !

Copy link
Contributor

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days. Maintainers can add the exempt-stale label.

@github-actions github-actions bot added the Stale label Apr 16, 2025
Copy link
Contributor

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 21, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants