mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
Extract Nginx log analyzer into a plugin that ships with Discourse.
This commit is contained in:
parent
0bafb52a03
commit
1ea1cefb35
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -46,6 +46,7 @@ log/
|
|||
!/plugins/lazyYT/
|
||||
!/plugins/poll/
|
||||
!/plugins/discourse-details/
|
||||
!/plugins/discourse-nginx-performance-report
|
||||
/plugins/*/auto_generated/
|
||||
|
||||
/spec/fixtures/plugins/my_plugin/auto_generated
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
module Jobs
|
||||
class DailyPerformanceReport < Jobs::Scheduled
|
||||
every 1.day
|
||||
per_host
|
||||
|
||||
def execute(args)
|
||||
if SiteSetting.daily_performance_report &&
|
||||
RailsMultisite::ConnectionManagement.current_db == "default"
|
||||
result = `ruby #{Rails.root}/script/nginx_analyze.rb --limit 1440`
|
||||
report_data =
|
||||
if result.strip.empty?
|
||||
"Report is only available in latest image, please run:
|
||||
```text
|
||||
cd /var/discourse
|
||||
./launcher rebuild app
|
||||
```"
|
||||
else
|
||||
"```text\n#{result}\n```"
|
||||
end
|
||||
|
||||
PostCreator.create(Discourse.system_user,
|
||||
topic_id: performance_topic_id,
|
||||
raw: report_data,
|
||||
skip_validations: true)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def performance_topic_id
|
||||
|
||||
if SiteSetting.performance_report_topic_id > 0
|
||||
topic = Topic.find_by(id: SiteSetting.performance_report_topic_id)
|
||||
return topic.id if topic
|
||||
end
|
||||
|
||||
staff_category = Category.find_by(id: SiteSetting.staff_category_id)
|
||||
raise StandardError, "Staff category was not found" unless staff_category
|
||||
|
||||
post = PostCreator.create(Discourse.system_user,
|
||||
raw: I18n.t('performance_report.initial_post_raw'),
|
||||
category: staff_category.name,
|
||||
title: I18n.t('performance_report.initial_topic_title'),
|
||||
skip_validations: true)
|
||||
|
||||
|
||||
unless post && post.topic_id
|
||||
raise StandardError, "Could not create or retrieve performance report topic id"
|
||||
end
|
||||
|
||||
SiteSetting.performance_report_topic_id = post.topic_id
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
|
@ -1159,7 +1159,6 @@ ar:
|
|||
enable_mobile_theme: "اجهزه الموبايل تستخدم ثيم مناسب للجوال,امكانيه التحويل للموقع الكامل .الغي هذا اذا اردت استخدام انماط سريعه الاستجابه"
|
||||
dominating_topic_minimum_percent: "ما هي النسبه المئويه للمشاركات التي يجب علي المستخدم عملها في الموضوع قبل تلقيه لتنبيه عن خروجه لنطاق الموضوع"
|
||||
disable_avatar_education_message: "عطل الرسالة التعليمية لتغيير الصورة الرمزية."
|
||||
daily_performance_report: "تحليل سجلات NGINX يومي ونشر موضوع \"قاقم فقط\" مع التفاصيل"
|
||||
suppress_uncategorized_badge: "لا تظهر الوسام للمواضيع غير المصنفة في قائمة الموضوع."
|
||||
global_notice: "اعرض تنبيه, شعار عام طارئ ملاحظه لكل الزوار, غير الفراغ لاخفاء(HTML مسموح)"
|
||||
disable_edit_notifications: "لتعطيل تحرير الاشعارات بواسطة العضو النظام عندما يكون نشطاً 'download_remote_images_to_local'."
|
||||
|
|
|
@ -1073,7 +1073,6 @@ de:
|
|||
enable_mobile_theme: "Mobilgeräte verwenden eine mobile Darstellung mit der Möglichkeit zur vollständigen Site zu wechseln. Deaktiviere diese Option, wenn du ein eigenes Full-Responsive-Stylesheet verwenden möchtest."
|
||||
dominating_topic_minimum_percent: "Anteil der Nachrichten eines Themas in Prozent, die ein einzelner Benutzer verfassen darf, bevor dieser Benutzer darauf hingewiesen wird, dass er dieses Thema dominiert."
|
||||
disable_avatar_education_message: "Weise Benutzer nicht darauf hin, dass sie ihren Avatar ändern können"
|
||||
daily_performance_report: "Analysiere die NGINX-Logs täglich. Poste anschließend eine Zusammenfassung als Beitrag, welcher nur für Moderatoren oder Administratoren zugänglich ist."
|
||||
suppress_uncategorized_badge: "Zeige kein Abzeichen für unkategorisierte Themen in der Themenliste."
|
||||
permalink_normalizations: "Diesen regulären Ausdruck anwenden, bevor Permalinks verarbeitet werden; Beispiel: /(topic.*)\\?.*/\\1 wird Query-Strings von Themen-Routen entfernen. Format: regulärer Ausdruck + String, benutze \\1 usw. um Teilausdrücke zu verwenden"
|
||||
global_notice: "Zeigt allen Besuchern eine DRINGENDE NOTFALL-NACHRICHT als global sichtbares Banner an. Deaktiviert bei leerer Nachricht. (HTML ist erlaubt.)"
|
||||
|
|
|
@ -1264,8 +1264,6 @@ en:
|
|||
|
||||
disable_avatar_education_message: "Disable education message for changing avatar."
|
||||
|
||||
daily_performance_report: "Analyze NGINX logs daily and post a Staff Only topic with details"
|
||||
|
||||
suppress_uncategorized_badge: "Don't show the badge for uncategorized topics in topic lists."
|
||||
|
||||
permalink_normalizations: "Apply the following regex before matching permalinks, for example: /(topic.*)\\?.*/\\1 will strip query strings from topic routes. Format is regex+string use \\1 etc. to access captures"
|
||||
|
|
|
@ -1070,7 +1070,6 @@ es:
|
|||
enable_mobile_theme: "Los dispositivos móviles utilizan un tema adaptado, con la habilidad de cambiar al estilo de sitio completo. Deshabilita esta opción si quieres utilizar una plantilla personalizada que sea completamente adaptable."
|
||||
dominating_topic_minimum_percent: "Qué porcentaje de posts tiene que publicar un usuario en un mismo tema hasta mostrarle un recordatorio acerca de dominar en demasía un tema."
|
||||
disable_avatar_education_message: "Desactivar mensaje incentivador para que los usuarios se cambien su foto de perfil."
|
||||
daily_performance_report: "Analizar registros de NGINX diariamente y publicar un tema para Administradores con los detalles"
|
||||
suppress_uncategorized_badge: "No mostrar la etiqueta de los temas sin categoría en la lista de temas."
|
||||
permalink_normalizations: "Aplicar la siguiente expresión regular antes de los enlaces, por ejemplo: /(topic.*)\\?.*/\\1 despojará las cadenas de consulta de las rutas de los temas. El formato es regex+string usa \\1 etc. para acceder a capturas"
|
||||
global_notice: "Mostrar una noticia de URGENCIA o EMERGENCIA para todos los visitantes, deja este campo en blanco para ocultarla (se puede utilizar código HTML)"
|
||||
|
|
|
@ -868,7 +868,6 @@ fa_IR:
|
|||
allow_profile_backgrounds: "به کاربر اجازه بده تا پس زمینه نمایه خود را آپلود کنند."
|
||||
enable_mobile_theme: "دستگاه های موبایلی که از تم دوستانه موبایل استفاده می کنن٬ با قابلیت جابجایی به حالت تمام سایت. این را از کار بیانداز اگر می خواهی از شیوه سفارشی استفاده کنی که بطور کامل پاسخگو است."
|
||||
dominating_topic_minimum_percent: " پست های یک کاربر چند درصد باید درست کنند در یک جستار قبل از اینکه یادآوری بشن درباره بیش از اندازه بودن آن در یک جستار. "
|
||||
daily_performance_report: "تحلیل لاگهای NGINX و ارسال یک پست شامل جزئیات ویژه مدیران"
|
||||
suppress_uncategorized_badge: "مدال برای جستارهای شناخته نشده در لیست جستارها نشان نده. "
|
||||
global_notice: "بنر فوری ٬ اضطراری را بصورت سراسری به تمام بازدیدکنندگان نشان بده٬ برای مخفی کردن آن را به خالی عوض کن (HTML allowed)."
|
||||
disable_edit_notifications: "آگاهی ساز ویرایش را از کار بینداز از طریق کاربر سیستم وقتی 'download_remote_images_to_local' فعال است "
|
||||
|
|
|
@ -1087,7 +1087,6 @@ fi:
|
|||
enable_mobile_theme: "Mobiililaitteet käyttävät erillistä teemaa ja kahden välillä on mahdollista vaihtaa. Poista asetus käytöstä, jos haluat käyttää omaa tyylitiedostoa, joka on mukautuva eri laitteille."
|
||||
dominating_topic_minimum_percent: "Kuinka monta prosenttia ketjun viesteistä käyttäjän täytyy kirjoittaa, ennen kuin tulee muistutetuksi ketjun dominoinnista."
|
||||
disable_avatar_education_message: "Piilota opastusviesti, joka näytetään kun profiilikuvaa vaihdetaan."
|
||||
daily_performance_report: "Analysoi NGINX lokit päivittäin ja julkaise vain henkilökunnalle näkyvä ketju yksityiskohdista"
|
||||
suppress_uncategorized_badge: "Älä näytä alueettomille ketjuille tunnusta ketjujen listauksissa."
|
||||
global_notice: "Näytä KIIREELLISESTÄ HÄTÄTAPAUKSESTA kertova banneri kaikilla sivuilla kaikille käyttäjille, vaihda tyhjäksi piilottaaksesi sen (HTML sallittu)."
|
||||
disable_edit_notifications: "Poista muokkausilmoitukset system-käyttäjältä, kun 'download_remote_images_to_local' on asetettu."
|
||||
|
|
|
@ -1061,7 +1061,6 @@ fr:
|
|||
enable_mobile_theme: "Les appareils mobiles utilisent un thème adapté aux mobiles, avec la possibilité de passer à la totalité du site. Désactivez cette option si vous voulez utiliser une feuille de style personnalisée qui répond à tous les types de client."
|
||||
dominating_topic_minimum_percent: "Quel est le pourcentage de messages un utilisateur doit poster dans un sujet avant d'être rappelé à l'ordre pour laissé la communauté répondre."
|
||||
disable_avatar_education_message: "Désactiver le message incitant à changer l'avatar."
|
||||
daily_performance_report: "Analyser les logs de NGINX quotidiennement et poster un sujet Responsables Uniquement avec les détails"
|
||||
suppress_uncategorized_badge: "Ne pas afficher le badge pour les sujets non catégorisés dans les listes des sujets."
|
||||
permalink_normalizations: "Appliquer l'expression régulière suivante avant de faire correspondre les permaliens, par exemple /(\\/topic.*)\\?.*/\\1 supprimera les query strings des routes des sujets. Le format est regex+string, utilisez \\1 etc. pour accéder aux captures"
|
||||
global_notice: "Affiche un bandeau global URGENT pour tout les utilisateurs du site, laissez vide pour le cacher (HTML autorisé)."
|
||||
|
|
|
@ -910,7 +910,6 @@ he:
|
|||
allow_profile_backgrounds: "אפשרו למשתמשים להעלות רקעים לפרופיל."
|
||||
enable_mobile_theme: "Mobile devices use a mobile-friendly theme, with the ability to switch to the full site. Disable this if you want to use a custom stylesheet that is fully responsive."
|
||||
dominating_topic_minimum_percent: "איזה אחוז מהפרסומים משתמש צריך לייצר בנושא לפני שיקבל תזכורת לגבי שליטת/שתלטנות יתר על הנושא."
|
||||
daily_performance_report: "Analyze NGINX logs daily and post a Staff Only topic with details"
|
||||
suppress_uncategorized_badge: "אל תציגו את התג (badge) לנושאים נטולי קטגוריה ברשימת הנושאים."
|
||||
global_notice: "הציגו הודעת אזהרה דחופה כללית לכל המבקרים, החליפו לריק כדי להסתיר אותה (ניתן להשתמש ב-HTML)."
|
||||
disable_edit_notifications: "ביטול התראות עריכה על ידי משתמש המערכת כאשר 'download_remote_images_to_local' פעיל."
|
||||
|
|
|
@ -844,7 +844,6 @@ ja:
|
|||
allow_profile_backgrounds: "プロフィール背景のアップロードを許可"
|
||||
enable_mobile_theme: "モバイル端末にモバイル向けテーマ (通常サイト用テーマにスイッチ可能) を利用する。レスポンシブなスタイルシートを使用する場合はこの設定を無効にしてください。"
|
||||
dominating_topic_minimum_percent: "ユーザがトピックを占拠しているとリマインドを行う、ポスト投稿支配率 "
|
||||
daily_performance_report: "日別のNGINXのログを解析し、Staff Onlyトピックへ詳細を投稿する"
|
||||
suppress_uncategorized_badge: "トピック一覧でカテゴライズされていないトピックのバッジは表示しない"
|
||||
global_notice: "緊急の内容を表示します。全ての訪問者の緊急バナーで注意を行います。隠すには空白に変更してください(HTMLが許可されています)"
|
||||
disable_edit_notifications: "システムユーザが'download_remote_images_to_local' を有効にした場合、編集時の通知を無効にする"
|
||||
|
|
|
@ -843,7 +843,6 @@ ko:
|
|||
allow_profile_backgrounds: "사용자에게 프로필 배경 이미지 업로드를 허용합니다."
|
||||
enable_mobile_theme: "모바일 디바이스는 모바일 환경에 친화적인 테마를 사용합니다, 그리고 PC용 화면으로 전환할 수 있습니다. 만약 커스텀 스타일 시트를 사용한다면 이것을 비활성화 시키세요."
|
||||
dominating_topic_minimum_percent: "한 글타래에서 한 사용자의 영향력을 결정하는 글 수의 퍼센트"
|
||||
daily_performance_report: "NGINX 일별 로그를 분석하고 상세정보를 스태프들에게 글타래 게시"
|
||||
suppress_uncategorized_badge: "글타래 리스트에서 카테고리가 없는 글타래에 대한 훈장을 보여주지 않는다."
|
||||
global_notice: "긴급, 비상 전체 배너를 모든 방문자에게 표시합니다. 숨기려면 빈칸으로 바꾸면 됩니다(HTML 허용)."
|
||||
disable_edit_notifications: "'download_remote_images_to_local'가 활성화되있으면 시스템 사용자에 의한 수정 알림을 비활성화합니다."
|
||||
|
|
|
@ -992,7 +992,6 @@ nl:
|
|||
sequential_replies_threshold: "Aantal berichten dat een gebruiker achter elkaar in één topic moet plaatsen voordat hij een melding krijgt over te veel opeenvolgende reacties."
|
||||
enable_mobile_theme: "Mobiele apparaten gebruiken een mobiel-vriendelijke theme met de mogelijkheid te schakelen naar de volledige site. Schakel deze optie uit als je een eigen stylesheet wil gebruiken die volledig responsive is."
|
||||
dominating_topic_minimum_percent: "Welk percentage van de berichten een gebruiker moet maken in een onderwerp voordat ze worden herinnerd aan het te veel domineren van een topic."
|
||||
daily_performance_report: "Analyseer elke dag NGINX logs en post een Alleen Voor Medewerkers topic met de details"
|
||||
suppress_uncategorized_badge: "Laat de badge niet zien voor topics zonder categorie in de topiclijsten."
|
||||
global_notice: "Laat een LET OP, BELANGRIJK-banner zien aan alle gebruikers. Laat leeg om niet te tonen (HTML is toegestaan)."
|
||||
disable_edit_notifications: "Schakelt bewerkingsnotificaties van de systeemgebruiker uit als 'download_remote_images_to_local' actief is."
|
||||
|
|
|
@ -1080,7 +1080,6 @@ pt:
|
|||
enable_mobile_theme: "Os dispositivos móveis usam um tema mobile-friendly, com a possibilidade de mudar para o sítio completo. Desative isto se quer usar um estilo personalizado que é totalmente responsivo."
|
||||
dominating_topic_minimum_percent: "Que percentagem de mensagens um utilizador tem que fazer num tópico antes de ser relembrado sobre dominar demasiado um tópico."
|
||||
disable_avatar_education_message: "Desativar mensagem educativa para alteração de avatar."
|
||||
daily_performance_report: "Analise os logs diários NGINX e publique um tópico visível apenas para o pessoal com detalhes"
|
||||
suppress_uncategorized_badge: "Não mostrar distintivos para tópicos sem categoria nas listagens de tópicos."
|
||||
permalink_normalizations: "Aplicar a seguinte expressão regular antes de igualar hiperligações permanentes, por exemplo: /(topic.*)\\?.*/\\1 irá remover parâmetros de roteamento para tópicos. O formato é regex+sequência utilize \\1 etc. para aceder a capturas.O formato é regex+string utilize \\1 etc. para aceder a capturas."
|
||||
global_notice: "Exibir um banner global URGENTE, EMERGÊNCIA a todos os visitantes, mudar para branco para esconder (HTML permitido)."
|
||||
|
|
|
@ -980,7 +980,6 @@ pt_BR:
|
|||
allow_profile_backgrounds: "Permitir usuários de fazerem upload de backgrounds para o perfil"
|
||||
enable_mobile_theme: "Os dispositivos móveis usam um tema mobile-friendly, com a possibilidade de mudar para o site completo. Desative isso se você quiser usar um estilo personalizado que é totalmente responsivo."
|
||||
dominating_topic_minimum_percent: "Qual o percentual de postagens que um usuário precisa fazer em um tópico antes de ser relembrado sobre ser excessivamente dominante em um tópico."
|
||||
daily_performance_report: "Analiza logs do NGINX diariamente e cria um tópico na categoria Somente Equipe com os detalhes."
|
||||
suppress_uncategorized_badge: "Não mostrar emblema para assuntos não categorizados em listas de tópicos"
|
||||
global_notice: "Mostrar um banner global URGENTE, de EMERGÊNCIA para todos os visitantes, mude para branco para esconder (HTML permitido)."
|
||||
disable_edit_notifications: "Desabilitar modificação de notificações pelo sistema quando 'download_remote_images_to_local' estiver ativado."
|
||||
|
|
|
@ -1002,7 +1002,6 @@ ru:
|
|||
enable_mobile_theme: "Мобильные устройства используют адаптированную тему с возможностью переключения в обычный вид. Отключите данную настройку если вы хотите использовать собственный стиль для мобильных устройств."
|
||||
dominating_topic_minimum_percent: "Количество сообщений, отправленных пользователем подряд в одной теме, прежде чем ему будет показано предупреждение о слишком частых ответах."
|
||||
disable_avatar_education_message: "Отключить обучающее сообщение при смене аватара."
|
||||
daily_performance_report: "Ежедневно анализировать логи сервера NGINX и отправлять сообщение с результатами анализа в тему, видимую только персоналу."
|
||||
suppress_uncategorized_badge: "Не показывать награду в списках тем для тех тем, которые вне разделов."
|
||||
global_notice: "Показать СРОЧНОЕ ВАЖНОЕ объявление на сайте всем пользователям и посетителям. Удалите содержание, чтобы отменить объявление. Разрешено использование HTML."
|
||||
disable_edit_notifications: "Отключить уведомления системы пользователя когда 'download_remote_images_to_local' активна."
|
||||
|
|
|
@ -1025,7 +1025,6 @@ sk:
|
|||
enable_mobile_theme: "Mobilné zariadenia používajú tému pre mobilné zariadenia s možnosťou prepnutia na plnú verziu stránok. Vypnite, ak chcete použiť vlastný štýl, ktorý podporuje mobilné zariadenia."
|
||||
dominating_topic_minimum_percent: "Koľko percent príspevkou musí pouťívateľ pridať do témy než sa mu zobrazí pripomienka o dominovaní témy."
|
||||
disable_avatar_education_message: "Vypnúť informatívnu hlášku na zmenu avatara."
|
||||
daily_performance_report: "Denne analyzuj NGINX logy a z detailov vytváraj témy iba pre zamestnancov."
|
||||
suppress_uncategorized_badge: "V zozname tém nezobrazuj odznak za nekategorizované príspevky."
|
||||
global_notice: "Pre všetkých návštevníkov zobraz URGENTNÉ, KRÍZOVÉ globálné záhlavie, zmeň na čierne a schovaj (HTML povolené)."
|
||||
disable_edit_notifications: "Ak je premenná 'download_remote_images_to_local' aktívna, vypnúť notifikácie o úpravách systémového používateľa."
|
||||
|
|
|
@ -888,7 +888,6 @@ sq:
|
|||
allow_profile_backgrounds: "Allow users to upload profile backgrounds."
|
||||
enable_mobile_theme: "Mobile devices use a mobile-friendly theme, with the ability to switch to the full site. Disable this if you want to use a custom stylesheet that is fully responsive."
|
||||
dominating_topic_minimum_percent: "What percentage of posts a user has to make in a topic before being reminded about overly dominating a topic."
|
||||
daily_performance_report: "Analyze NGINX logs daily and post a Staff Only topic with details"
|
||||
suppress_uncategorized_badge: "Don't show the badge for uncategorized topics in topic lists."
|
||||
global_notice: "Display an URGENT, EMERGENCY global banner notice to all visitors, change to blank to hide it (HTML allowed)."
|
||||
disable_edit_notifications: "Disables edit notifications by the system user when 'download_remote_images_to_local' is active."
|
||||
|
|
|
@ -918,7 +918,6 @@ tr_TR:
|
|||
allow_profile_backgrounds: "Kullanıcıların profillerine arkaplan eklemesine izin ver."
|
||||
enable_mobile_theme: "Mobil cihazlar mobil uyumlu temayı kullanır, dilerse masaüstü görünüme geçebilirler. Eğer özel, duyarlı bir stil kullanıyorsanız bunu devredışı bırakın."
|
||||
dominating_topic_minimum_percent: "Konuyu domine ettiğine dair uyarı almadan önce konudaki gönderilerin yüzde kaçının kullanıcıya ait olması gerekir."
|
||||
daily_performance_report: "NGINX kayıtlarını analiz edip detaylı bir şekilde günlük Yetkili kategorisinde bir konu içerisinde paylaş."
|
||||
suppress_uncategorized_badge: "Kategorisiz konular için olan rozeti konu listesinde gösterme."
|
||||
global_notice: "Tüm ziyaretçilere İVEDİ ACİL DURUM global manşet uyarısı göster, saklamak için boş bırakın (HTML kullanılabilir)."
|
||||
disable_edit_notifications: " 'download_remote_images_to_local' etkin olduğunda, sistem kullanıcısından gelen düzenleme bildirilerini devre dışı bırakır"
|
||||
|
|
|
@ -999,7 +999,6 @@ vi:
|
|||
enable_mobile_theme: "Thiết bị di động có thể sử dụng giao diện riêng, với khả năng chuyển sang chế độ xem đầy đủ. Tắt thiết lập này nếu bạn muốn sử dụng một style tùy biến hỗ trợ responsive."
|
||||
dominating_topic_minimum_percent: "Số phần trăm bài viết mà một thành viên có thể gửi trong một chủ đề trước khi được nhắc nhở về hành vi muốn tạo ưu thế trong chủ đề."
|
||||
disable_avatar_education_message: "Tắt thông điệp hướng dẫn khi đổi avatar."
|
||||
daily_performance_report: "Phân tích nhật ký NGINX hàng ngày và gửi cho BQT thông tin chi tiết"
|
||||
suppress_uncategorized_badge: "Không hiển thị huy hiệu cho các chủ đề chưa phân loại trong danh sách chủ đề"
|
||||
permalink_normalizations: "Áp dụng regex sau trước khi khớp với permalink, ví dụ: /(topic.*)\\?.*/\\1 sẽ loại bỏ các chuỗi truy vấn từ đường dẫn chủ đề. Định dạng regex+string với \\1 ... để giữ truy cập"
|
||||
global_notice: "Hiển thị banner KHẨN CẤP, THÔNG BÁO KHẨN trên toàn website để thông báo cho tất cả các khách ghé thăm, bỏ trống để ẩn (hỗ trợ HTML)."
|
||||
|
|
|
@ -1007,7 +1007,6 @@ zh_CN:
|
|||
enable_mobile_theme: "为移动设备启用移动友好的主题,但也能切换回完整站点。如果你想要使用自定义的响应式主题请禁用它。"
|
||||
dominating_topic_minimum_percent: "用户在主题中的帖子占到多少百分比时使得用户主导话题。"
|
||||
disable_avatar_education_message: "禁用更改头像操作的教育消息。"
|
||||
daily_performance_report: "每日分析 NGINX 日志并且发布详情主题到管理人员才能看到的主题"
|
||||
suppress_uncategorized_badge: "不要为主题列表中的未分类主题显示徽章。"
|
||||
permalink_normalizations: "在匹配永久链接之前应用如下正则表达式,例如:/(topic.*)\\?.*/\\1 将去掉所有主题路径的参数字符串。格式为使用正则表达式+使用 \\1 等字符串来访问捕获内容"
|
||||
global_notice: "为所有访客显示“紧急的”全局横幅,留空隐藏它(可以使用 HTML)"
|
||||
|
|
|
@ -1088,9 +1088,6 @@ uncategorized:
|
|||
dominating_topic_minimum_percent: 20
|
||||
disable_avatar_education_message: false
|
||||
|
||||
# Reporting
|
||||
daily_performance_report: false
|
||||
|
||||
global_notice:
|
||||
default: ""
|
||||
client: true
|
||||
|
@ -1118,10 +1115,6 @@ uncategorized:
|
|||
default: -1
|
||||
hidden: true
|
||||
|
||||
performance_report_topic_id:
|
||||
default: -1
|
||||
hidden: true
|
||||
|
||||
notify_about_flags_after: 48
|
||||
|
||||
enable_cdn_js_debugging: false
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
ar:
|
||||
site_settings:
|
||||
daily_performance_report: "تحليل سجلات NGINX يومي ونشر موضوع \"قاقم فقط\" مع التفاصيل"
|
|
@ -0,0 +1,3 @@
|
|||
de:
|
||||
site_settings:
|
||||
daily_performance_report: "Analysiere die NGINX-Logs täglich. Poste anschließend eine Zusammenfassung als Beitrag, welcher nur für Moderatoren oder Administratoren zugänglich ist."
|
|
@ -0,0 +1,3 @@
|
|||
en:
|
||||
site_settings:
|
||||
daily_performance_report: "Analyze NGINX logs daily and post a Staff Only topic with details"
|
|
@ -0,0 +1,3 @@
|
|||
es:
|
||||
site_settings:
|
||||
daily_performance_report: "Analizar registros de NGINX diariamente y publicar un tema para Administradores con los detalles"
|
|
@ -0,0 +1,3 @@
|
|||
fa_IR:
|
||||
site_settings:
|
||||
daily_performance_report: "تحلیل لاگهای NGINX و ارسال یک پست شامل جزئیات ویژه مدیران"
|
|
@ -0,0 +1,3 @@
|
|||
fi:
|
||||
site_settings:
|
||||
daily_performance_report: "Analysoi NGINX lokit päivittäin ja julkaise vain henkilökunnalle näkyvä ketju yksityiskohdista"
|
|
@ -0,0 +1,3 @@
|
|||
fr:
|
||||
site_settings:
|
||||
daily_performance_report: "Analyser les logs de NGINX quotidiennement et poster un sujet Responsables Uniquement avec les détails"
|
|
@ -0,0 +1,3 @@
|
|||
he:
|
||||
site_settings:
|
||||
daily_performance_report: "Analyze NGINX logs daily and post a Staff Only topic with details"
|
|
@ -0,0 +1,3 @@
|
|||
ja:
|
||||
site_settings:
|
||||
daily_performance_report: "日別のNGINXのログを解析し、Staff Onlyトピックへ詳細を投稿する"
|
|
@ -0,0 +1,3 @@
|
|||
ko:
|
||||
site_settings:
|
||||
daily_performance_report: "NGINX 일별 로그를 분석하고 상세정보를 스태프들에게 글타래 게시"
|
|
@ -0,0 +1,3 @@
|
|||
nl:
|
||||
site_settings:
|
||||
daily_performance_report: "Analyseer elke dag NGINX logs en post een Alleen Voor Medewerkers topic met de details"
|
|
@ -0,0 +1,3 @@
|
|||
pt:
|
||||
site_settings:
|
||||
daily_performance_report: "Analise os logs diários NGINX e publique um tópico visível apenas para o pessoal com detalhes"
|
|
@ -0,0 +1,3 @@
|
|||
pt_BR:
|
||||
site_settings:
|
||||
daily_performance_report: "Analiza logs do NGINX diariamente e cria um tópico na categoria Somente Equipe com os detalhes."
|
|
@ -0,0 +1,3 @@
|
|||
ru:
|
||||
site_settings:
|
||||
daily_performance_report: "Ежедневно анализировать логи сервера NGINX и отправлять сообщение с результатами анализа в тему, видимую только персоналу."
|
|
@ -0,0 +1,3 @@
|
|||
sk:
|
||||
site_settings:
|
||||
daily_performance_report: "Denne analyzuj NGINX logy a z detailov vytváraj témy iba pre zamestnancov."
|
|
@ -0,0 +1,3 @@
|
|||
sq:
|
||||
site_settings:
|
||||
daily_performance_report: "Analyze NGINX logs daily and post a Staff Only topic with details"
|
|
@ -0,0 +1,3 @@
|
|||
tr_TR:
|
||||
site_settings:
|
||||
daily_performance_report: "NGINX kayıtlarını analiz edip detaylı bir şekilde günlük Yetkili kategorisinde bir konu içerisinde paylaş."
|
|
@ -0,0 +1,3 @@
|
|||
vi:
|
||||
site_settings:
|
||||
daily_performance_report: "Phân tích nhật ký NGINX hàng ngày và gửi cho BQT thông tin chi tiết"
|
|
@ -0,0 +1,3 @@
|
|||
zh_CN:
|
||||
site_settings:
|
||||
daily_performance_report: "每日分析 NGINX 日志并且发布详情主题到管理人员才能看到的主题"
|
|
@ -0,0 +1,6 @@
|
|||
plugins:
|
||||
# Reporting
|
||||
daily_performance_report: false
|
||||
performance_report_topic_id:
|
||||
default: -1
|
||||
hidden: true
|
67
plugins/discourse-nginx-performance-report/plugin.rb
Normal file
67
plugins/discourse-nginx-performance-report/plugin.rb
Normal file
|
@ -0,0 +1,67 @@
|
|||
# name: discourse-nginx-performance-report
|
||||
# about: Analyzing Discourse Performance using NGINX logs
|
||||
# version: 0.1
|
||||
# url: https://github.com/discourse/discourse/tree/master/plugins/discourse-nginx-performance-report
|
||||
|
||||
after_initialize do
|
||||
module ::Jobs
|
||||
class DailyPerformanceReport < Scheduled
|
||||
every 1.day
|
||||
per_host
|
||||
|
||||
def execute(args)
|
||||
if SiteSetting.daily_performance_report &&
|
||||
RailsMultisite::ConnectionManagement.current_db == "default"
|
||||
result = `ruby #{Rails.root}/plugins/discourse-nginx-performance-report/script/nginx_analyze.rb --limit 1440`
|
||||
|
||||
binding.pry
|
||||
|
||||
report_data =
|
||||
if result.strip.empty?
|
||||
<<~TEXT
|
||||
Report is only available in latest image, please run:
|
||||
|
||||
```text
|
||||
cd /var/discourse
|
||||
./launcher rebuild app
|
||||
```
|
||||
TEXT
|
||||
else
|
||||
"```text\n#{result}\n```"
|
||||
end
|
||||
|
||||
PostCreator.create(Discourse.system_user,
|
||||
topic_id: performance_topic_id,
|
||||
raw: report_data,
|
||||
skip_validations: true)
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
def performance_topic_id
|
||||
if SiteSetting.performance_report_topic_id > 0
|
||||
topic = Topic.find_by(id: SiteSetting.performance_report_topic_id)
|
||||
return topic.id if topic
|
||||
end
|
||||
|
||||
staff_category = Category.find_by(id: SiteSetting.staff_category_id)
|
||||
raise StandardError, "Staff category was not found" unless staff_category
|
||||
|
||||
post = PostCreator.create(Discourse.system_user,
|
||||
raw: I18n.t('performance_report.initial_post_raw'),
|
||||
category: staff_category.name,
|
||||
title: I18n.t('performance_report.initial_topic_title'),
|
||||
skip_validations: true)
|
||||
|
||||
|
||||
unless post && post.topic_id
|
||||
raise StandardError, "Could not create or retrieve performance report topic id"
|
||||
end
|
||||
|
||||
SiteSetting.performance_report_topic_id = post.topic_id
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -40,7 +40,7 @@ class LogAnalyzer
|
|||
user_agent =~ /Mobile|Android|webOS/ && !(user_agent =~ /iPad|Nexus (7|10)/)
|
||||
end
|
||||
|
||||
def parsed_time
|
||||
def parsed_timge
|
||||
DateTime.strptime(time, TIME_FORMAT) if time
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user