Skip to content

Instantly share code, notes, and snippets.

@fujiwara
Created May 20, 2015 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fujiwara/fd7abb102a7666971cd6 to your computer and use it in GitHub Desktop.
Save fujiwara/fd7abb102a7666971cd6 to your computer and use it in GitHub Desktop.
multitail-consul
#!/usr/bin/perl
use strict;
use warnings;
my $regex = shift;
my $cmd = quotemeta(shift);
my @nodes = `consul members -status alive`;
shift @nodes; # dispose header
@nodes = grep /$regex/, map { (split /\s+/, $_)[0] } @nodes;
my @args;
for my $n (@nodes) {
push @args, "-L", "ssh $n $cmd";
}
exec "multitail", "--mergeall", @args;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment