Commit a5732b07 authored by Paul Slaughter's avatar Paul Slaughter

Merge branch 'bvl-remove-admin-logs' into 'master'

Remove logs from the admin pages

See merge request gitlab-org/gitlab!30485
parents b5701d31 70cea1ea
# frozen_string_literal: true
class Admin::LogsController < Admin::ApplicationController
before_action :loggers
def show
end
private
def loggers
@loggers ||= [
Gitlab::AppJsonLogger,
Gitlab::GitLogger,
Gitlab::EnvironmentLogger,
Gitlab::SidekiqLogger,
Gitlab::RepositoryCheckLogger,
Gitlab::ProjectServiceLogger,
Gitlab::Kubernetes::Logger
]
end
end
Admin::LogsController.prepend_if_ee('EE::Admin::LogsController')
......@@ -59,7 +59,7 @@ module NavHelper
end
def admin_monitoring_nav_links
%w(system_info background_jobs logs health_check requests_profiles)
%w(system_info background_jobs health_check requests_profiles)
end
def group_issues_sub_menu_items
......
- page_title "Logs"
%ul.nav-links.log-tabs.nav.nav-tabs
- @loggers.each do |klass|
%li.nav-item
= link_to klass.file_name, "##{klass.file_name_noext}", data: { toggle: 'tab' }, class: "#{active_when(klass == @loggers.first)} nav-link"
.row-content-block
To prevent performance issues admin logs output the last 2000 lines
.tab-content
- @loggers.each do |klass|
.tab-pane{ class: active_when(klass == @loggers.first), id: klass.file_name_noext }
.file-holder#README
.js-file-title.file-title
%i.fa.fa-file
= klass.file_name
.float-right
= link_to '#', class: 'log-bottom' do
%i.fa.fa-arrow-down
Scroll down
.file-content.logs
%ol
- klass.read_latest.each do |line|
%li
%p= line
......@@ -14,11 +14,9 @@
.col-md-12
.card
.card-header.alert.alert-danger
Last repository check
= "(#{time_ago_with_tooltip(@project.last_repository_check_at)})"
failed. See
= link_to 'repocheck.log', admin_logs_path
for error messages.
- last_check_message = _("Last repository check (%{last_check_timestamp}) failed. See the 'repocheck.log' file for error messages.")
- last_check_message = last_check_message % { last_check_timestamp: time_ago_with_tooltip(@project.last_repository_check_at) }
= last_check_message.html_safe
.row
.col-md-6
.card
......@@ -135,24 +133,18 @@
.card.repository-check
.card-header
Repository check
= _("Repository check")
.card-body
= form_for @project, url: repository_check_admin_project_path(@project), method: :post do |f|
.form-group
- if @project.last_repository_check_at.nil?
This repository has never been checked.
= _("This repository has never been checked.")
- elsif @project.last_repository_check_failed?
- failed_message = _("This repository was last checked %{last_check_timestamp}. The check %{strong_start}failed.%{strong_end} See the 'repocheck.log' file for error messages.")
- failed_message = failed_message % { last_check_timestamp: @project.last_repository_check_at.to_s(:medium), strong_start: "<strong class='cred'>", strong_end: "</strong>" }
= failed_message.html_safe
- else
This repository was last checked
= @project.last_repository_check_at.to_s(:medium) + '.'
The check
- if @project.last_repository_check_failed?
= succeed '.' do
%strong.cred failed
See
= link_to 'repocheck.log', admin_logs_path
for error messages.
- else
passed.
= _("This repository was last checked %{last_check_timestamp}. The check passed.") % { last_check_timestamp: @project.last_repository_check_at.to_s(:medium) }
= link_to icon('question-circle'), help_page_path('administration/repository_checks')
......
......@@ -56,7 +56,7 @@
= _('Monitoring')
%ul.sidebar-sub-level-items{ data: { qa_selector: 'admin_sidebar_monitoring_submenu_content' } }
= nav_link(controller: %w(system_info background_jobs logs health_check requests_profiles), html_options: { class: "fly-out-top-item" } ) do
= nav_link(controller: %w(system_info background_jobs health_check requests_profiles), html_options: { class: "fly-out-top-item" } ) do
= link_to admin_system_info_path do
%strong.fly-out-top-item-name
= _('Monitoring')
......@@ -69,10 +69,6 @@
= link_to admin_background_jobs_path, title: _('Background Jobs') do
%span
= _('Background Jobs')
= nav_link(controller: :logs) do
= link_to admin_logs_path, title: _('Logs') do
%span
= _('Logs')
= nav_link(controller: :health_check) do
= link_to admin_health_check_path, title: _('Health Check') do
%span
......
---
title: Remove logs from the admin pages
merge_request: 30485
author:
type: removed
......@@ -81,7 +81,6 @@ namespace :admin do
post :preview, on: :collection
end
resource :logs, only: [:show]
resource :health_check, controller: 'health_check', only: [:show]
resource :background_jobs, controller: 'background_jobs', only: [:show]
......
# frozen_string_literal: true
module EE::Admin::LogsController
include ::Gitlab::Utils::StrongMemoize
extend ::Gitlab::Utils::Override
override :loggers
def loggers
strong_memoize(:loggers) do
super + [
Gitlab::GeoLogger
]
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe 'Admin browses logs' do
before do
sign_in(create(:admin))
end
it 'shows available log files' do
visit admin_logs_path
expect(page).to have_link 'geo.log'
end
end
......@@ -12222,6 +12222,9 @@ msgstr ""
msgid "Last reply by"
msgstr ""
msgid "Last repository check (%{last_check_timestamp}) failed. See the 'repocheck.log' file for error messages."
msgstr ""
msgid "Last repository check run"
msgstr ""
......@@ -17712,6 +17715,9 @@ msgstr ""
msgid "Repository URL"
msgstr ""
msgid "Repository check"
msgstr ""
msgid "Repository check was triggered."
msgstr ""
......@@ -21778,9 +21784,18 @@ msgstr ""
msgid "This repository"
msgstr ""
msgid "This repository has never been checked."
msgstr ""
msgid "This repository is currently empty. A new Auto DevOps pipeline will be created after a new file has been pushed to a branch."
msgstr ""
msgid "This repository was last checked %{last_check_timestamp}. The check %{strong_start}failed.%{strong_end} See the 'repocheck.log' file for error messages."
msgstr ""
msgid "This repository was last checked %{last_check_timestamp}. The check passed."
msgstr ""
msgid "This runner will only run on pipelines triggered on protected branches"
msgstr ""
......
# frozen_string_literal: true
require 'spec_helper'
describe 'Admin browses logs' do
before do
sign_in(create(:admin))
end
it 'shows available log files' do
visit admin_logs_path
expect(page).to have_link 'application_json.log'
expect(page).to have_link 'git_json.log'
expect(page).to have_link 'test.log'
expect(page).to have_link 'sidekiq.log'
expect(page).to have_link 'repocheck.log'
expect(page).to have_link 'kubernetes.log'
end
end
......@@ -113,13 +113,6 @@ describe Admin::HookLogsController, 'routing' do
end
end
# admin_logs GET /admin/logs(.:format) admin/logs#show
describe Admin::LogsController, "routing" do
it "to #show" do
expect(get("/admin/logs")).to route_to('admin/logs#show')
end
end
# admin_background_jobs GET /admin/background_jobs(.:format) admin/background_jobs#show
describe Admin::BackgroundJobsController, "routing" do
it "to #show" do
......
......@@ -58,15 +58,6 @@ describe 'layouts/nav/sidebar/_admin' do
it_behaves_like 'page has active sub tab', 'Users'
end
context 'on logs' do
before do
allow(controller).to receive(:controller_name).and_return('logs')
end
it_behaves_like 'page has active tab', 'Monitoring'
it_behaves_like 'page has active sub tab', 'Logs'
end
context 'on messages' do
before do
allow(controller).to receive(:controller_name).and_return('broadcast_messages')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment