Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logtail more than 10 lines #35

Merged
merged 3 commits into from
Oct 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bin/broadside
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ command :deploy do |d|
subcmd.arg_name 'INSTANCE'
subcmd.flag [:n, :instance], type: Fixnum

subcmd.desc 'Number of lines to tail'
subcmd.default_value 10
subcmd.arg_name 'TAIL_LINES'
subcmd.flag [:l, :lines], type: Fixnum

add_shared_deploy_configs(subcmd)
end

Expand Down
2 changes: 2 additions & 0 deletions lib/broadside/configuration/deploy_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class DeployConfig < ConfigStruct
:env_vars,
:command,
:instance,
:lines,
:predeploy_commands,
:service_config,
:task_definition_config
Expand Down Expand Up @@ -51,6 +52,7 @@ def initialize
@instance = 0
@service_config = nil
@task_definition_config = nil
@lines = 10
end

# Validates format of deploy targets
Expand Down
1 change: 1 addition & 0 deletions lib/broadside/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def initialize(opts)
@deploy_config.rollback = opts[:rollback] || @deploy_config.rollback
@deploy_config.instance = opts[:instance] || @deploy_config.instance
@deploy_config.command = opts[:command] || @deploy_config.command
@deploy_config.lines = opts[:lines] || @deploy_config.lines
end

def short
Expand Down
2 changes: 1 addition & 1 deletion lib/broadside/deploy/ecs_deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def logtail
ip = get_running_instance_ip
debug "Tailing logs for running container at ip #{ip}..."
search_pattern = Shellwords.shellescape(family)
cmd = "docker logs -f --tail=10 `docker ps -n 1 --quiet --filter name=#{search_pattern}`"
cmd = "docker logs -f --tail=#{@deploy_config.lines} `docker ps -n 1 --quiet --filter name=#{search_pattern}`"
tail_cmd = gen_ssh_cmd(ip) + " '#{cmd}'"
exec tail_cmd
end
Expand Down