Bug 1985195 - error: omfile: default template already set via module global parameter
Summary: error: omfile: default template already set via module global parameter
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: rsyslog
Version: 33
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Attila Lakatos
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-07-23 06:53 UTC by Pavel Raiskup
Modified: 2022-05-14 19:04 UTC (History)
9 users (show)

Fixed In Version: rsyslog-8.2102.0-5.fc36
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-08-25 07:55:54 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Pavel Raiskup 2021-07-23 06:53:23 UTC
I see this in the `systemctl status rsyslog` output:

Jul 23 06:47:54 dev-coprbe.devel.redhat.com rsyslogd[2537572]: error during parsing file /etc/rsyslog.d/01-remote.conf, on or before line 13: omfile: default template already set via module global parameter - can no longer be changed [v8.2010.0 try https://www.rsyslog.com/e/2207 ]

This seems to be coming from:
https://github.com/rsyslog/rsyslog/blob/master/tools/omfile.c#L355

What I need:
rsyslog started without errors

Comment 2 Fedora Admin user for bugzilla script actions 2021-08-16 12:09:07 UTC
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.

Comment 3 Pavel Raiskup 2021-08-20 13:04:15 UTC
Attila, tihs is IMO problem of /etc/rsyslog.conf, line 13:

-module(load="builtin:omfile" Template="RSYSLOG_TraditionalFileFormat")
+module(load="builtin:omfile")

This is though in the default rsyslog.conf file (shipped with the package).

Comment 4 Attila Lakatos 2021-08-23 06:08:39 UTC
Hi Pavel

(In reply to Pavel Raiskup from comment #3)
> Attila, tihs is IMO problem of /etc/rsyslog.conf, line 13:
> 
> -module(load="builtin:omfile" Template="RSYSLOG_TraditionalFileFormat")
> +module(load="builtin:omfile")
I am not sure if this solves your issue, because by default "RSYSLOG_TraditionalFileFormat" is used when the Template is not specified, thus parsing /etc/rsyslog.d/01-remote.conf will signal a warning message.
The reason why I would not remove module(load="builtin:omfile" Template="RSYSLOG_TraditionalFileFormat") from the main config file is the following:
Let's assume you have multiple config files inside /etc/rsyslog.d/ directory, some of them might use omfile actions, so in that case users should always put the module(load=...) to the first config file(by alphabetical order).

> 
> This is though in the default rsyslog.conf file (shipped with the package).

Comment 5 Pavel Raiskup 2021-08-23 07:19:59 UTC

Ah, OK, your explanation makes sense I think.

The contents of the 01-remote.conf file is then:

      1 #
      2 # Ansible managed
      3 #
      4 
      5 # This is basically the RSYSLOG_SyslogProtocol23Format, which is RFC 5424 on
      6 # the wire, but with the message payload a CEE/Lumberjack JSON document.
      7 template(name="BITSCOUT_SyslogProtocol23Format" type="string"
      8     string="<%PRI%>1 %TIMESTAMP:::date-rfc3339% %HOSTNAME% %APP-NAME% %PROCID% %MSGID% %STRUCTURED-DATA% @cee:%$!%\n")
      9 
     10 set $!msg = $msg;
     11 
     12 # Use updated timestamp format for local files
     13 $ActionFileDefaultTemplate RSYSLOG_FileFormat
     14 
     15 $ActionQueueFileName remote   # unique name prefix for spool files
     16 $ActionQueueMaxDiskSpace 1g   # 1gb space limit (use as much as possible)
     17 $ActionQueueSaveOnShutdown on # save messages to disk on shutdown
     18 $ActionQueueType LinkedList   # run asynchronously
     19 $ActionResumeRetryCount -1    # infinite retries if host is down
     20 
     21 
     22 *.* @@10.0.12.155:514;BITSCOUT_SyslogProtocol23Format

So the complaining line is `$ActionFileDefaultTemplate RSYSLOG_FileFormat`.  Is
Is it incorrect to do this, then?

Comment 6 Attila Lakatos 2021-08-24 05:48:52 UTC
The problem is that the omfile module has been loaded with the default Template in your main configuration file and you are trying to rewrite the default template via $ActionFileDefaultTemplate(you can set it only once). You might want to consider setting the default template to whatever you want in /etc/rsyslog.conf and remove $ActionFileDefaultTemplate RSYSLOG_FileFormat from 01-remote.conf.

Anyway, in this file you are using BITSCOUT_SyslogProtocol23Format template for omfile actions instead of the default, so I think it's okay to just remove line 13.

Comment 7 Pavel Raiskup 2021-08-24 07:54:08 UTC
> The problem is that the omfile module has been loaded with the default Template in your main configuration file and you are trying to rewrite the default template via

Yes.  But the default config file is installed by the package, I haven't configured the default template myself.

The intention is to just install stuff into /etc/rsyslog.d/ and keep /etc/rsyslog.conf as-is (in package-maintainer format).

That's why I reported this issue;  I would prefer if the template was *not* set in /etc/rsyslog.conf, because
it is now the only reason why we have to ansible-configure /etc/rsyslog.conf.

Comment 9 Attila Lakatos 2021-08-25 07:23:48 UTC
Now I see your point here. Note that if we remove the Template="RSYSLOG_TraditionalFileFormat" when loading omfile module, the default will be still RSYSLOG_TraditionalFileFormat, which should be set internally.

Comment 10 Fedora Update System 2021-08-25 07:53:14 UTC
FEDORA-2021-fd229188eb has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2021-fd229188eb

Comment 11 Fedora Update System 2021-08-25 07:55:54 UTC
FEDORA-2021-fd229188eb has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 12 Pavel Raiskup 2021-08-25 10:26:09 UTC
Thank you!

Comment 13 Fabrice Bellet 2022-05-14 19:04:42 UTC
(In reply to Attila Lakatos from comment #9)
> Now I see your point here. Note that if we remove the
> Template="RSYSLOG_TraditionalFileFormat" when loading omfile module, the
> default will be still RSYSLOG_TraditionalFileFormat, which should be set
> internally.

I'm afraid this is not the case. With this modification, the log format changed
to "2022-05-14T18:36:35.541849+02:00 <hostname> ..." instead of  "May 14 19:19:07 <hostname> ..."


Note You need to log in before you can comment on or make changes to this bug.