How to stop Jellyfin from logging to system log

How to stop Jellyfin from logging to system log

By default, Jellyfin on CentOS logs to the main system log. This isn’t an issue except in odd instances, like for example when part of library is located on a remote network attached storage that isn’t permanently available (not a great idea, but powersaving does exist). This makes Jellyfin log thousands of lines of warnings when (re)scanning the libraries and hits the missing media locations:

Mar 11 20:12:46 srv jellyfin[1376]: System.IO.DirectoryNotFoundException: Could not find a part of the path '/storage/remote/media/Media/TV'.
Mar 11 20:12:46 srv jellyfin[1376]:   at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
Mar 11 20:12:46 srv jellyfin[1376]:   at System.IO.Enumeration.FileSystemEnumerator`1.Init()
Mar 11 20:12:46 srv jellyfin[1376]:   at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized)
Mar 11 20:12:46 srv jellyfin[1376]:   at System.IO.Enumeration.FileSystemEnumerableFactory.FileSystemInfos(String directory, String expression, EnumerationOptions options, Boolean isNormalized)
Mar 11 20:12:46 srv jellyfin[1376]:   at System.IO.DirectoryInfo.InternalEnumerateInfos(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
Mar 11 20:12:46 srv jellyfin[1376]:   at Emby.Server.Implementations.IO.ManagedFileSystem.GetFileSystemEntries(String path, Boolean recursive)
Mar 11 20:12:46 srv jellyfin[1376]:   at MediaBrowser.Controller.Providers.DirectoryService.<>c.b__5_0(String p, IFileSystem fileSystem)
Mar 11 20:12:46 srv jellyfin[1376]:   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd[TArg](TKey key, Func`3 valueFactory, TArg factoryArgument)
Mar 11 20:12:46 srv jellyfin[1376]:   at MediaBrowser.Controller.IO.FileData.GetFilteredFileSystemEntries(IDirectoryService directoryService, String path, IFileSystem fileSystem, IServerApplicationHost appHost, ILogger logger, ItemResolveArgs args, Int32 flattenFolderDepth, Boolea$
Mar 11 20:12:46 srv jellyfin[1376]:   at Emby.Server.Implementations.Library.LibraryManager.ResolvePath(FileSystemMetadata fileInfo, IDirectoryService directoryService, IItemResolver[] resolvers, Folder parent, String collectionType, LibraryOptions libraryOptions)
Mar 11 20:12:46 srv jellyfin[1376]: [20:12:46] [ERR] [163] Emby.Server.Implementations.Library.LibraryManager: Error in PlaylistResolver resolving /storage/remote/media/Media/TV

This further causes lfd to send warning notifications about the log flooding:

Alert:    *Error* Log line flooding/looping in /var/log/messages. Reopening log file

To prevent Jelllyfin from filling up the main log, edit /etc/jellyfin/logging.json and remove the highlighted lines:

{
    "Serilog": {
        "MinimumLevel": {
            "Default": "Information",
            "Override": {
                "Microsoft": "Warning",
                "System": "Warning"
            }
        },
        "WriteTo": [
            {
                "Name": "Console",
                "Args": {
                    "outputTemplate": "[{Timestamp:HH:mm:ss}] [{Level:u3}] [{ThreadId}] {SourceContext}: {Message:lj}{NewLine}{Exception}"
                }
            },
            {
                "Name": "Async",
                "Args": {
                    "configure": [
                        {
                            "Name": "File",
                            "Args": {
                                "path": "%JELLYFIN_LOG_DIR%//log_.log",
                                "rollingInterval": "Day",
                                "retainedFileCountLimit": 3,
                                "rollOnFileSizeLimit": true,
                                "fileSizeLimitBytes": 100000000,
                                "outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] [{ThreadId}] {SourceContext}: {Message}{NewLine}{Exception}"
                            }
                        }
                    ]
                }
            }
        ],
        "Enrich": [ "FromLogContext", "WithThreadId" ]
    }
}

Then restart Jellyfin:

systemctl stop jellyfin
systemctl start jelyfin

Check that it is running correctly with:

systemctl status jellyfin

Leave a Reply