From 825551d64f0af9114ee9987f58aa8e253c9e7d41 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 3 Feb 2023 15:08:36 +0900 Subject: [PATCH] drop syslog Close #9774 --- .config/docker_example.yml | 5 ----- .config/example.yml | 5 ----- CHANGELOG.md | 1 + chart/files/default.yml | 5 ----- packages/backend/package.json | 2 -- packages/backend/src/config.ts | 7 +------ packages/backend/src/core/LoggerService.ts | 18 +----------------- packages/backend/src/logger.ts | 18 +----------------- pnpm-lock.yaml | 21 --------------------- 9 files changed, 4 insertions(+), 78 deletions(-) diff --git a/.config/docker_example.yml b/.config/docker_example.yml index bd5eab492b..f8124bc9df 100644 --- a/.config/docker_example.yml +++ b/.config/docker_example.yml @@ -114,11 +114,6 @@ id: 'aid' # IP address family used for outgoing request (ipv4, ipv6 or dual) #outgoingAddressFamily: ipv4 -# Syslog option -#syslog: -# host: localhost -# port: 514 - # Proxy for HTTP/HTTPS #proxy: http://127.0.0.1:3128 diff --git a/.config/example.yml b/.config/example.yml index cabf167fba..8fe41da15a 100644 --- a/.config/example.yml +++ b/.config/example.yml @@ -114,11 +114,6 @@ id: 'aid' # IP address family used for outgoing request (ipv4, ipv6 or dual) #outgoingAddressFamily: ipv4 -# Syslog option -#syslog: -# host: localhost -# port: 514 - # Proxy for HTTP/HTTPS #proxy: http://127.0.0.1:3128 diff --git a/CHANGELOG.md b/CHANGELOG.md index 57035a94f2..b634ec3b69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ You should also include the user name that made the change. ### Changes - twitter/github/discord連携機能が削除されました - ハッシュタグごとのチャートが削除されました +- syslogのサポートが削除されました ### Improvements diff --git a/chart/files/default.yml b/chart/files/default.yml index 862951d4d5..4061ca3eb6 100644 --- a/chart/files/default.yml +++ b/chart/files/default.yml @@ -133,11 +133,6 @@ id: "aid" # IP address family used for outgoing request (ipv4, ipv6 or dual) #outgoingAddressFamily: ipv4 -# Syslog option -#syslog: -# host: localhost -# port: 514 - # Proxy for HTTP/HTTPS #proxy: http://127.0.0.1:3128 diff --git a/packages/backend/package.json b/packages/backend/package.json index 3496c79c78..762cb4b4d5 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -110,7 +110,6 @@ "strict-event-emitter-types": "2.0.0", "stringz": "2.1.0", "summaly": "2.7.0", - "syslog-pro": "git+https://github.com/misskey-dev/SyslogPro#0.2.9-misskey.2", "systeminformation": "5.17.8", "tinycolor2": "1.5.2", "tmp": "0.2.1", @@ -167,7 +166,6 @@ "@types/sharp": "0.31.1", "@types/sinonjs__fake-timers": "8.1.2", "@types/speakeasy": "2.0.7", - "@types/syslog-pro": "1.0.0", "@types/tinycolor2": "1.4.3", "@types/tmp": "0.2.3", "@types/unzipper": "0.10.5", diff --git a/packages/backend/src/config.ts b/packages/backend/src/config.ts index 025d7acdeb..1d4e700656 100644 --- a/packages/backend/src/config.ts +++ b/packages/backend/src/config.ts @@ -65,11 +65,6 @@ export type Source = { deliverJobMaxAttempts?: number; inboxJobMaxAttempts?: number; - syslog: { - host: string; - port: number; - }; - mediaProxy?: string; proxyRemoteFiles?: boolean; @@ -113,7 +108,7 @@ const path = process.env.NODE_ENV === 'test' export function loadConfig() { const meta = JSON.parse(fs.readFileSync(`${_dirname}/../../../built/meta.json`, 'utf-8')); - const clientManifestExists = fs.existsSync(_dirname + '/../../../built/_vite_/manifest.json') + const clientManifestExists = fs.existsSync(_dirname + '/../../../built/_vite_/manifest.json'); const clientManifest = clientManifestExists ? JSON.parse(fs.readFileSync(`${_dirname}/../../../built/_vite_/manifest.json`, 'utf-8')) : { 'src/init.ts': { file: 'src/init.ts' } }; diff --git a/packages/backend/src/core/LoggerService.ts b/packages/backend/src/core/LoggerService.ts index 221631f129..441c254f48 100644 --- a/packages/backend/src/core/LoggerService.ts +++ b/packages/backend/src/core/LoggerService.ts @@ -1,5 +1,4 @@ import { Inject, Injectable } from '@nestjs/common'; -import * as SyslogPro from 'syslog-pro'; import { DI } from '@/di-symbols.js'; import type { Config } from '@/config.js'; import Logger from '@/logger.js'; @@ -8,29 +7,14 @@ import type { KEYWORD } from 'color-convert/conversions'; @Injectable() export class LoggerService { - private syslogClient; - constructor( @Inject(DI.config) private config: Config, ) { - if (this.config.syslog) { - this.syslogClient = new SyslogPro.RFC5424({ - applicationName: 'Misskey', - timestamp: true, - includeStructuredData: true, - color: true, - extendedColor: true, - server: { - target: config.syslog.host, - port: config.syslog.port, - }, - }); - } } @bindThis public getLogger(domain: string, color?: KEYWORD | undefined, store?: boolean) { - return new Logger(domain, color, store, this.syslogClient); + return new Logger(domain, color, store); } } diff --git a/packages/backend/src/logger.ts b/packages/backend/src/logger.ts index 5d275bc7b2..87f9b12313 100644 --- a/packages/backend/src/logger.ts +++ b/packages/backend/src/logger.ts @@ -17,15 +17,13 @@ export default class Logger { private context: Context; private parentLogger: Logger | null = null; private store: boolean; - private syslogClient: any | null = null; - constructor(context: string, color?: KEYWORD, store = true, syslogClient = null) { + constructor(context: string, color?: KEYWORD, store = true) { this.context = { name: context, color: color, }; this.store = store; - this.syslogClient = syslogClient; } @bindThis @@ -69,20 +67,6 @@ export default class Logger { console.log(important ? chalk.bold(log) : log); if (level === 'error' && data) console.log(data); - - if (store) { - if (this.syslogClient) { - const send = - level === 'error' ? this.syslogClient.error : - level === 'warning' ? this.syslogClient.warning : - level === 'success' ? this.syslogClient.info : - level === 'debug' ? this.syslogClient.info : - level === 'info' ? this.syslogClient.info : - null as never; - - send.bind(this.syslogClient)(message).catch(() => {}); - } - } } @bindThis diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 82dc47531a..a2771fadff 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -104,7 +104,6 @@ importers: '@types/sharp': 0.31.1 '@types/sinonjs__fake-timers': 8.1.2 '@types/speakeasy': 2.0.7 - '@types/syslog-pro': 1.0.0 '@types/tinycolor2': 1.4.3 '@types/tmp': 0.2.3 '@types/unzipper': 0.10.5 @@ -192,7 +191,6 @@ importers: strict-event-emitter-types: 2.0.0 stringz: 2.1.0 summaly: 2.7.0 - syslog-pro: git+https://github.com/misskey-dev/SyslogPro#0.2.9-misskey.2 systeminformation: 5.17.8 tinycolor2: 1.5.2 tmp: 0.2.1 @@ -297,7 +295,6 @@ importers: strict-event-emitter-types: 2.0.0 stringz: 2.1.0 summaly: 2.7.0 - syslog-pro: github.com/misskey-dev/SyslogPro/2772b33fa126784fc6e21377786471a918b22dc7 systeminformation: 5.17.8 tinycolor2: 1.5.2 tmp: 0.2.1 @@ -356,7 +353,6 @@ importers: '@types/sharp': 0.31.1 '@types/sinonjs__fake-timers': 8.1.2 '@types/speakeasy': 2.0.7 - '@types/syslog-pro': 1.0.0 '@types/tinycolor2': 1.4.3 '@types/tmp': 0.2.3 '@types/unzipper': 0.10.5 @@ -2817,10 +2813,6 @@ packages: resolution: {integrity: sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==} dev: true - /@types/syslog-pro/1.0.0: - resolution: {integrity: sha512-yFQ7QbEQrswboLGflCumcUMLeD5GgnaHH80khqoYDdeEqVST5UWTppit8BtavxhrkWjfeX8aPI6c047ooWQrdw==} - dev: true - /@types/throttle-debounce/5.0.0: resolution: {integrity: sha512-Pb7k35iCGFcGPECoNE4DYp3Oyf2xcTd3FbFQxXUI9hEYKUl6YX+KLf7HrBmgVcD05nl50LIH6i+80js4iYmWbw==} dev: true @@ -9489,10 +9481,6 @@ packages: obliterator: 2.0.4 dev: false - /moment/2.29.4: - resolution: {integrity: sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==} - dev: false - /ms/2.0.0: resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} dev: false @@ -13662,15 +13650,6 @@ packages: readable-stream: 3.6.0 dev: false - github.com/misskey-dev/SyslogPro/2772b33fa126784fc6e21377786471a918b22dc7: - resolution: {tarball: https://codeload.github.com/misskey-dev/SyslogPro/tar.gz/2772b33fa126784fc6e21377786471a918b22dc7} - name: '@zeit/syslog-pro' - version: 0.2.9-misskey.2 - engines: {node: '>=10.0.0'} - dependencies: - moment: 2.29.4 - dev: false - github.com/misskey-dev/browser-image-resizer/0227e860621e55cbed0aabe6dc601096a7748c4a: resolution: {tarball: https://codeload.github.com/misskey-dev/browser-image-resizer/tar.gz/0227e860621e55cbed0aabe6dc601096a7748c4a} name: browser-image-resizer