mirror of
https://github.com/fluent/fluentd-ui.git
synced 2025-08-12 09:17:05 +02:00
Fix error when log file is not created yet
This commit is contained in:
parent
5f8e28a841
commit
e73915c76e
@ -11,6 +11,7 @@ class Fluentd
|
|||||||
end
|
end
|
||||||
|
|
||||||
def log
|
def log
|
||||||
|
return "" unless File.exists?(log_file)
|
||||||
File.read(log_file) # TODO: large log file
|
File.read(log_file) # TODO: large log file
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -32,6 +33,8 @@ class Fluentd
|
|||||||
end
|
end
|
||||||
|
|
||||||
def log_tail(limit = nil)
|
def log_tail(limit = nil)
|
||||||
|
return [] unless File.exists?(log_file)
|
||||||
|
|
||||||
limit = limit.to_i rescue 0
|
limit = limit.to_i rescue 0
|
||||||
limit = limit.zero? ? Settings.default_log_tail_count : limit
|
limit = limit.zero? ? Settings.default_log_tail_count : limit
|
||||||
io = File.open(log_file)
|
io = File.open(log_file)
|
||||||
|
Loading…
Reference in New Issue
Block a user