Rsyslogd lacks the module imfile

It seems like the Package Rsyslogd from the official source lacks the module imfile.

The imfile.so module was not integrated into the rsyslogd, I would like to be able to monitor files in my unraid box or any of the docker containers and send to a remote syslog server for storage and parsing. Most standard linux like Ubuntu and CentOS come with it included by default.

logs:
input module name 'imfile' is unknown [v8.2110.0 try https://www.rsyslog.com/e/2209 ]
could not load module 'imfile', errors: trying to load module /usr/lib/rsyslog/imfile.so: Error loading shared library /usr/lib/rsyslog/imfile.so: No such file or directory [v8.2110.0 try https://www.rsyslog.com/e/2066 ]

How can I do? how to add this module into rsyslog? I tried to opkg install rsyslog-imfile, but nothing

That is not helpful; OpenWrt is not a full OS. Expecting it to is going to irritate you.

Have you tried to cat /usr/lib/rsyslog/imfile.so? It may just be set to read only, or you could add it since it is a log.

If you use LuCI it is just rsyslog and it will install the dependencies none of which is imfile.

# ll /usr/lib/rsyslog/
drwxr-xr-x    2 root     root          1024 Feb 18 00:17 ./
drwxr-xr-x    1 root     root          5120 Jul 10  2023 ../
-rwxr-xr-x    1 root     root          1084 Jul  8  2022 fmhash.la*
-rwxr-xr-x    1 root     root         12594 Jul  8  2022 fmhash.so*
-rwxr-xr-x    1 root     root          1084 Jul  8  2022 imklog.la*
-rwxr-xr-x    1 root     root         21844 Jul  8  2022 imklog.so*
-rwxr-xr-x    1 root     root          1084 Jul  8  2022 immark.la*
-rwxr-xr-x    1 root     root         13321 Jul  8  2022 immark.so*
-rwxr-xr-x    1 root     root          1078 Jul  8  2022 imtcp.la*
-rwxr-xr-x    1 root     root         30937 Jul  8  2022 imtcp.so*
-rwxr-xr-x    1 root     root          1078 Jul  8  2022 imudp.la*
-rwxr-xr-x    1 root     root         30361 Jul  8  2022 imudp.so*
-rwxr-xr-x    1 root     root          1096 Jul  8  2022 imuxsock.la*
-rwxr-xr-x    1 root     root         34825 Jul  8  2022 imuxsock.so*
-rwxr-xr-x    1 root     root          1078 Jul  8  2022 lmnet.la*
-rwxr-xr-x    1 root     root         25217 Jul  8  2022 lmnet.so*
-rwxr-xr-x    1 root     root          1108 Jul  8  2022 lmnetstrms.la*
-rwxr-xr-x    1 root     root         22817 Jul  8  2022 lmnetstrms.so*
-rwxr-xr-x    1 root     root          1108 Jul  8  2022 lmnsd_ptcp.la*
-rwxr-xr-x    1 root     root         27041 Jul  8  2022 lmnsd_ptcp.so*
-rwxr-xr-x    1 root     root          1096 Jul  8  2022 lmregexp.la*
-rwxr-xr-x    1 root     root         12321 Jul  8  2022 lmregexp.so*
-rwxr-xr-x    1 root     root          1096 Jul  8  2022 lmtcpclt.la*
-rwxr-xr-x    1 root     root         12321 Jul  8  2022 lmtcpclt.so*
-rwxr-xr-x    1 root     root          1096 Jul  8  2022 lmtcpsrv.la*
-rwxr-xr-x    1 root     root         31649 Jul  8  2022 lmtcpsrv.so*
-rwxr-xr-x    1 root     root          1169 Jul  8  2022 lmzlibw.la*
-rwxr-xr-x    1 root     root         12321 Jul  8  2022 lmzlibw.so*
-rwxr-xr-x    1 root     root          1108 Jul  8  2022 mmexternal.la*
-rwxr-xr-x    1 root     root         16633 Jul  8  2022 mmexternal.so*
-rwxr-xr-x    1 root     root          1102 Jul  8  2022 omtesting.la*
-rwxr-xr-x    1 root     root         12321 Jul  8  2022 omtesting.so*

There is no IMFILE.SO in this directory, *.so is a builded binary library file, and could I can copy it from other linux?

This is not my best skillset, but I would assume it is looking for a place to build.

I'm sure someone will come in and know for sure but I read the page you provided and those instructions are for full OSs.
And the OpenWrt page Is not as informed as I'd like.

But this is about logging rsyslog so give it a once over.

rsyslog starts being mentioned about 2/3 down.

According to packages/admin/rsyslog/Config.in at openwrt-22.03 · openwrt/packages · GitHub

	config RSYSLOG_imfile
		bool "Enable file input module support"
		default n
		help
		  Enable input file module in rsyslog

imfile module is diasbled, I think I should build rsyslog by myself with enable imfile

1 Like

If you feel confident that you can undo it, I was leaning that way but my coding leaves a lot to desire.

But I see you did not look at the link for logging. I'd look it over first.

and, ummm. You are probably running 23.05.2. Hope 22.03 has not changed anything.

I have used this in the past (ie installing and using rsyslog on OpenWrt) and it worked just fine.

So I just installed it on a 23.05.2 system and it starts ok and the logs give:
Feb 21 09:53:44 meshnode-f5a4 : [origin software="rsyslogd" swVersion="8.2110.0" x-pid="24117" x-info="https://www.rsyslog.com"] start

I does not seem to need imfile.so, it does not complain about it being missing and it still works, at least when logging remotely from other OpenWrt routers...

How are you installing it?
I did:

opkg update
opkg install rsyslog
1 Like

This will certainly not work. You will have to rebuild rsyslog yourself, and make sure its build-time config matches your requirements (so that the proper shared object for imfile support gets built).

1 Like

I build openwrt by my-self, open the rsyslog-imfile flag

CONFIG_PACKAGE_rsyslog=m
# CONFIG_RSYSLOG_gssapi_krb5 is not set
# CONFIG_RSYSLOG_mysql is not set
# CONFIG_RSYSLOG_pgsql is not set
# CONFIG_RSYSLOG_libdbi is not set
# CONFIG_RSYSLOG_elasticsearch is not set
# CONFIG_RSYSLOG_omhttp is not set
# CONFIG_RSYSLOG_openssl is not set
# CONFIG_RSYSLOG_gnutls is not set
# CONFIG_RSYSLOG_mail is not set
# CONFIG_RSYSLOG_mmjsonparse is not set
# CONFIG_RSYSLOG_mmdblookup is not set
CONFIG_RSYSLOG_imfile=y

now, it works