diff --git a/app/assets/javascripts/vue/fluent_log.js b/app/assets/javascripts/vue/fluent_log.js index a22bfe5..2cab738 100644 --- a/app/assets/javascripts/vue/fluent_log.js +++ b/app/assets/javascripts/vue/fluent_log.js @@ -6,7 +6,7 @@ new Vue({ el: "#fluent-log", - paramAttributes: ["logUrl"], + paramAttributes: ["logUrl", "initialAutoReload"], data: { "autoFetch": false, "logs": [], @@ -15,6 +15,9 @@ }, created: function(){ + if(this.initialAutoReload) { + this.autoFetch = true; + } this.fetchLogs(); var self = this; diff --git a/app/controllers/misc_controller.rb b/app/controllers/misc_controller.rb index 423f43b..e5a2fd5 100644 --- a/app/controllers/misc_controller.rb +++ b/app/controllers/misc_controller.rb @@ -47,7 +47,7 @@ class MiscController < ApplicationController end zip.get_output_stream('versions.txt') do |f| f.puts "ruby: #{RUBY_DESCRIPTION}" - f.puts "fluentd: #{Fluent::VERSION}" + f.puts "fluentd: #{FluentdUI.fluentd_version}" f.puts "fluentd-ui: #{FluentdUI::VERSION}" end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 40ce97e..3507f4a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -5,6 +5,10 @@ module ApplicationHelper File.exist?("/etc/init.d/td-agent") end + def fluentd_ui_title + ENV["FLUENTD_UI_TITLE"] || "Fluentd UI" + end + def language_name(locale) # NOTE: these are fixed terms, not i18n-ed { diff --git a/app/models/fluentd/agent/common.rb b/app/models/fluentd/agent/common.rb index b22b94b..e1e0a9c 100644 --- a/app/models/fluentd/agent/common.rb +++ b/app/models/fluentd/agent/common.rb @@ -66,7 +66,7 @@ class Fluentd end end - %w(running? log config config_write config_append log_tail configuration).each do |method| + %w(running? version log config config_write config_append log_tail configuration).each do |method| define_method(method) do raise NotImplementedError, "'#{method}' method is required to be defined" end diff --git a/app/models/fluentd/agent/fluentd_gem.rb b/app/models/fluentd/agent/fluentd_gem.rb index 1e2572b..7c75fd2 100644 --- a/app/models/fluentd/agent/fluentd_gem.rb +++ b/app/models/fluentd/agent/fluentd_gem.rb @@ -41,6 +41,12 @@ class Fluentd actual_reload end + def version + Bundler.with_clean_env do + `fluentd --version`.strip + end + end + private def options_to_argv diff --git a/app/models/fluentd/agent/td_agent.rb b/app/models/fluentd/agent/td_agent.rb index 53f217f..2e1e3a0 100644 --- a/app/models/fluentd/agent/td_agent.rb +++ b/app/models/fluentd/agent/td_agent.rb @@ -25,6 +25,10 @@ class Fluentd # https://github.com/treasure-data/td-agent/blob/master/debian/td-agent.init#L156 system('/etc/init.d/td-agent restart') end + + def version + `td-agent --version`.strip + end end end end diff --git a/app/models/plugin.rb b/app/models/plugin.rb index 9da967c..58dccd2 100644 --- a/app/models/plugin.rb +++ b/app/models/plugin.rb @@ -190,11 +190,16 @@ class Plugin end def fluent_gem_path + # On installed both td-agent and fluentd system, decide which fluent-gem command should be used depend on setup(Fluentd.instance) + if Fluentd.instance && Fluentd.instance.fluentd? + return "fluent-gem" # maybe `fluent-gem` command is in the $PATH + end + + # NOTE: td-agent has a command under the /usr/lib{,64}, td-agent2 has under /opt/td-agent %W( - fluent-gem + /opt/td-agent/embedded/bin/fluent-gem /usr/lib/fluent/ruby/bin/fluent-gem /usr/lib64/fluent/ruby/bin/fluent-gem - /opt/td-agent/embedded/bin/fluent-gem ).find do |path| system("which #{path}", out: File::NULL, err: File::NULL) end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 2cd945a..c00f5c9 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -7,7 +7,7 @@