|
| 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 | +}; |
0 commit comments