Commit f65058df authored by Bob Van Landuyt's avatar Bob Van Landuyt Committed by Paul Slaughter

Remove logs from the admin pages

This removes the logs from the admin dashboard. Those were reading
files from disk and do not work in multi-node environments.

Rather than displaying incorrect information, remove the feature. A
better solution is to ingest the logs into elasticsearch.

This also allows us to remove the symlinked sidekiq.log form omnibus.
parent d7bf5605
# 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
......@@ -16,9 +16,7 @@
.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.
failed. See the 'repocheck.log' file for error messages.
.row
.col-md-6
.card
......@@ -148,9 +146,7 @@
- if @project.last_repository_check_failed?
= succeed '.' do
%strong.cred failed
See
= link_to 'repocheck.log', admin_logs_path
for error messages.
See the 'repocheck.log' file for error messages.
- else
passed.
......
......@@ -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
# 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