Skip to content

Commit 1a37f27

Browse files
authored
Merge pull request #4802 from alltilla/jellyfin-source
scl: add `jellyfin()` source
2 parents 190651c + 64ef31e commit 1a37f27

File tree

6 files changed

+96
-0
lines changed

6 files changed

+96
-0
lines changed

lib/severity-aliases.table

+5
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,16 @@ alert, SYSLOG_SEVERITY_CODE(1)
4040
crit, SYSLOG_SEVERITY_CODE(2)
4141
critical, SYSLOG_SEVERITY_CODE(2)
4242
fatal, SYSLOG_SEVERITY_CODE(2)
43+
ftl, SYSLOG_SEVERITY_CODE(2)
4344
err, SYSLOG_SEVERITY_CODE(3)
4445
error, SYSLOG_SEVERITY_CODE(3)
4546
warning, SYSLOG_SEVERITY_CODE(4)
4647
warn, SYSLOG_SEVERITY_CODE(4)
48+
wrn, SYSLOG_SEVERITY_CODE(4)
4749
notice, SYSLOG_SEVERITY_CODE(5)
4850
info, SYSLOG_SEVERITY_CODE(6)
51+
inf, SYSLOG_SEVERITY_CODE(6)
4952
log, SYSLOG_SEVERITY_CODE(6)
5053
debug, SYSLOG_SEVERITY_CODE(7)
54+
dbg, SYSLOG_SEVERITY_CODE(7)
55+
vrb, SYSLOG_SEVERITY_CODE(7)

news/feature-4802.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
### Collecting Jellyfin logs
2+
3+
The new `jellyfin()` source, reads Jellyfin logs from its log file output.
4+
5+
Example minimal config:
6+
```
7+
source s_jellyfin {
8+
jellyfin(
9+
base-dir("/path/to/my/jellyfin/root/log/dir")
10+
filename-pattern("log_*.log")
11+
);
12+
};
13+
```
14+
15+
For more details about Jellyfin logging, see:
16+
* https://jellyfin.org/docs/general/administration/configuration/#main-configuration
17+
* https://jellyfin.org/docs/general/administration/configuration/#log-directory
18+
19+
As the `jellyfin()` source is based on a `wildcard-file()` source, all of the
20+
`wildcard-file()` source options are applicable, too.

scl/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ set(SCL_DIRS
1616
graylog2
1717
hdfs
1818
iptables
19+
jellyfin
1920
junos
2021
kafka
2122
linux-audit

scl/Makefile.am

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ SCL_SUBDIRS = \
1616
graylog2 \
1717
hdfs \
1818
iptables \
19+
jellyfin \
1920
junos \
2021
kafka \
2122
linux-audit \

scl/jellyfin/jellyfin.conf

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#############################################################################
2+
# Copyright (c) 2024 Attila Szakacs
3+
#
4+
# This program is free software; you can redistribute it and/or modify it
5+
# under the terms of the GNU General Public License version 2 as published
6+
# by the Free Software Foundation, or (at your option) any later version.
7+
#
8+
# This program is distributed in the hope that it will be useful,
9+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
# GNU General Public License for more details.
12+
#
13+
# You should have received a copy of the GNU General Public License
14+
# along with this program; if not, write to the Free Software
15+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16+
#
17+
# As an additional exemption you are allowed to compile & link against the
18+
# OpenSSL libraries as published by the OpenSSL project. See the file
19+
# COPYING for details.
20+
#
21+
#############################################################################
22+
#
23+
# Example log:
24+
# [2024-01-26 22:10:29.472 +00:00] [INF] [60] Jellyfin.Plugin.PlaybackReporting.EventMonitorEntryPoint: Processing playback tracker : "iOS_BDC12081-9570-4790-90B1-F32701F36064_1706303401.88791-89e6ced512284193bdaa42cb7ac66d8a-d9df60b89d30948fe88b64ee65a62543"
25+
26+
block parser jellyfin()
27+
{
28+
channel {
29+
parser {
30+
regexp-parser(
31+
patterns('^\[([^\]]*)\] \[([A-Z]{3})\] \[[0-9]+\] (?<MESSAGE>(?:.|\n)*)')
32+
# Apparently the pattern above hits the 32K JIT stack limit.
33+
flags("disable-jit")
34+
);
35+
date-parser(
36+
template("$1")
37+
format("%Y-%m-%d %H:%M:%S.%f %z")
38+
);
39+
};
40+
41+
rewrite {
42+
set("Jellyfin" value("APP"));
43+
set-severity("$2");
44+
};
45+
};
46+
};
47+
48+
block source jellyfin(
49+
base_dir()
50+
filename_pattern()
51+
) {
52+
channel {
53+
source {
54+
wildcard-file(
55+
base-dir("`base_dir`")
56+
filename-pattern("`filename_pattern`")
57+
multi-line-mode(regexp)
58+
multi-line-prefix('^\[[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3} ')
59+
multi-line-timeout(2)
60+
flags(no-parse)
61+
`__VARARGS__`
62+
);
63+
};
64+
parser {
65+
jellyfin();
66+
};
67+
};
68+
};

tests/copyright/policy

+1
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ scl/openobserve/.*\.conf$
220220
scl/pgsql/pgsql\.conf$
221221
scl/qbittorrent/qbittorrent\.conf$
222222
scl/pihole/pihole\.conf$
223+
scl/jellyfin/jellyfin\.conf$
223224
modules/python-modules/syslogng/modules/kubernetes/.*
224225
modules/ebpf/.*
225226
modules/python-modules/syslogng/modules/hypr/.*

0 commit comments

Comments
 (0)