All filters are optional
This commit is contained in:
@@ -84,7 +84,7 @@ class Mrsk::Cli::App < Mrsk::Cli::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
desc "logs", "Show last 100 log lines from app on servers"
|
desc "logs", "Show last 100 log lines from app on servers"
|
||||||
option :since, aliases: "-s", default: "5m", desc: "Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)"
|
option :since, aliases: "-s", desc: "Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)"
|
||||||
option :lines, type: :numeric, aliases: "-n", desc: "Number of log lines to pull from each server"
|
option :lines, type: :numeric, aliases: "-n", desc: "Number of log lines to pull from each server"
|
||||||
option :grep, aliases: "-g", desc: "Show lines with grep match only (use this to fetch specific requests by id)"
|
option :grep, aliases: "-g", desc: "Show lines with grep match only (use this to fetch specific requests by id)"
|
||||||
def logs
|
def logs
|
||||||
|
|||||||
@@ -31,11 +31,11 @@ class Mrsk::Commands::App < Mrsk::Commands::Base
|
|||||||
docker :ps, *service_filter
|
docker :ps, *service_filter
|
||||||
end
|
end
|
||||||
|
|
||||||
def logs(since: "5m", lines: nil, grep: nil)
|
def logs(since: nil, lines: nil, grep: nil)
|
||||||
pipe \
|
pipe \
|
||||||
current_container_id,
|
current_container_id,
|
||||||
"xargs docker logs --since #{since} -n #{lines} -t 2>&1",
|
"xargs docker logs #{"--since #{since}" if since}#{" -n #{lines}" if lines} -t 2>&1",
|
||||||
("grep #{grep}" if grep)
|
("grep '#{grep}'" if grep)
|
||||||
end
|
end
|
||||||
|
|
||||||
def exec(*command, interactive: false)
|
def exec(*command, interactive: false)
|
||||||
|
|||||||
Reference in New Issue
Block a user