diff options
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | cmd/dcat/main.go | 2 | ||||
| -rw-r--r-- | cmd/dgrep/main.go | 2 | ||||
| -rw-r--r-- | cmd/dmap/main.go | 2 | ||||
| -rw-r--r-- | cmd/dtail/main.go | 2 | ||||
| -rw-r--r-- | docker/Makefile | 21 | ||||
| -rw-r--r-- | docker/serverlist.txt | 40 | ||||
| -rw-r--r-- | internal/clients/baseclient.go | 2 | ||||
| -rw-r--r-- | internal/config/args.go | 6 | ||||
| -rw-r--r-- | internal/config/initializer.go | 8 |
10 files changed, 66 insertions, 21 deletions
@@ -37,4 +37,4 @@ Credits * Thank you [Mimecast](https://www.mimecast.com) for supporting this Open-Source project. * Thank you to **Vlad-Marian Marian** for creating the DTail (dog) logo. * The Gopher was generated at https://gopherize.me -* The animated Gifs were created using `asciinema` with `asciicast2gif`. Checkout [this](./doc/asciinema/README.md) for more information. +* The animated Gifs were created using `asciinema` with `asciicast2gif`. Check out [how this was done](./doc/asciinema/README.md) for more information. diff --git a/cmd/dcat/main.go b/cmd/dcat/main.go index 3f8bd5a..98da089 100644 --- a/cmd/dcat/main.go +++ b/cmd/dcat/main.go @@ -40,7 +40,7 @@ func main() { flag.StringVar(&args.LogDir, "logDir", "~/log", "Log dir") flag.StringVar(&args.Logger, "logger", config.DefaultClientLogger, "Logger name") flag.StringVar(&args.LogLevel, "logLevel", config.DefaultLogLevel, "Log level") - flag.StringVar(&args.SSHPrivateKeyPathFile, "key", "", "Path to private key") + flag.StringVar(&args.SSHPrivateKeyFilePath, "key", "", "Path to private key") flag.StringVar(&args.ServersStr, "servers", "", "Remote servers to connect") flag.StringVar(&args.UserName, "user", userName, "Your system user name") flag.StringVar(&args.What, "files", "", "File(s) to read") diff --git a/cmd/dgrep/main.go b/cmd/dgrep/main.go index 6924cf3..7c3cc3e 100644 --- a/cmd/dgrep/main.go +++ b/cmd/dgrep/main.go @@ -44,7 +44,7 @@ func main() { flag.StringVar(&args.LogDir, "logDir", "~/log", "Log dir") flag.StringVar(&args.Logger, "logger", config.DefaultClientLogger, "Logger name") flag.StringVar(&args.LogLevel, "logLevel", config.DefaultLogLevel, "Log level") - flag.StringVar(&args.SSHPrivateKeyPathFile, "key", "", "Path to private key") + flag.StringVar(&args.SSHPrivateKeyFilePath, "key", "", "Path to private key") flag.StringVar(&args.RegexStr, "regex", ".", "Regular expression") flag.StringVar(&args.ServersStr, "servers", "", "Remote servers to connect") flag.StringVar(&args.UserName, "user", userName, "Your system user name") diff --git a/cmd/dmap/main.go b/cmd/dmap/main.go index a40da88..e024b37 100644 --- a/cmd/dmap/main.go +++ b/cmd/dmap/main.go @@ -44,7 +44,7 @@ func main() { flag.StringVar(&args.LogDir, "logDir", "~/log", "Log dir") flag.StringVar(&args.Logger, "logger", config.DefaultClientLogger, "Logger name") flag.StringVar(&args.LogLevel, "logLevel", config.DefaultLogLevel, "Log level") - flag.StringVar(&args.SSHPrivateKeyPathFile, "key", "", "Path to private key") + flag.StringVar(&args.SSHPrivateKeyFilePath, "key", "", "Path to private key") flag.StringVar(&args.QueryStr, "query", "", "Map reduce query") flag.StringVar(&args.ServersStr, "servers", "", "Remote servers to connect") flag.StringVar(&args.UserName, "user", userName, "Your system user name") diff --git a/cmd/dtail/main.go b/cmd/dtail/main.go index af22779..ec6a5cc 100644 --- a/cmd/dtail/main.go +++ b/cmd/dtail/main.go @@ -57,7 +57,7 @@ func main() { flag.StringVar(&args.LogDir, "logDir", "~/log", "Log dir") flag.StringVar(&args.Logger, "logger", config.DefaultClientLogger, "Logger name") flag.StringVar(&args.LogLevel, "logLevel", config.DefaultLogLevel, "Log level") - flag.StringVar(&args.SSHPrivateKeyPathFile, "key", "", "Path to private key") + flag.StringVar(&args.SSHPrivateKeyFilePath, "key", "", "Path to private key") flag.StringVar(&args.QueryStr, "query", "", "Map reduce query") flag.StringVar(&args.RegexStr, "regex", ".", "Regular expression") flag.StringVar(&args.ServersStr, "servers", "", "Remote servers to connect") diff --git a/docker/Makefile b/docker/Makefile index a2ee81a..57240e2 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -1,3 +1,4 @@ +NUM_INSTANCES ?= 10 all: build testrun: build spinup dcat spindown serverfarm: spindown build spinup @@ -9,26 +10,26 @@ build: rm ./dserver rm ./mapr_testdata.log spinup: - ./spinup.sh 10 + ./spinup.sh ${NUM_INSTANCES} spindown: - ./spindown.sh 10 + ./spindown.sh ${NUM_INSTANCES} spinup1: docker run -p 2222:2222 dserver:develop dtail: - ../dtail --user fred --key id_rsa_docker --servers serverlist.txt --files '/var/log/dserver/*' --trustAllHosts --logLevel DEBUG + ../dtail --user paul --key id_rsa_docker --servers serverlist.txt --files '/var/log/dserver/*' --trustAllHosts --logLevel DEBUG dtail2: - ../dtail --user fred --key id_rsa_docker --servers serverlist.txt --files '/var/log/dserver/*' --trustAllHosts --logLevel DEBUG --query 'from stats select max($$goroutines),count($$hostname),$$hostname,last($$time) group by $$hostname order by max($$goroutines)' + ../dtail --user paul --key id_rsa_docker --servers serverlist.txt --files '/var/log/dserver/*' --trustAllHosts --logLevel DEBUG --query 'from stats select max($$goroutines),count($$hostname),$$hostname,last($$time) group by $$hostname order by max($$goroutines)' dgrep: - ../dgrep --user fred --key id_rsa_docker --servers serverlist.txt --files '/var/log/dserver/*' --regex MAPREDUCE --trustAllHosts + ../dgrep --user paul --key id_rsa_docker --servers serverlist.txt --files '/var/log/dserver/*' --regex MAPREDUCE --trustAllHosts dcat: - ../dcat --user fred --key id_rsa_docker --servers serverlist.txt --files '/etc/passwd' --trustAllHosts + ../dcat --user paul --key id_rsa_docker --servers serverlist.txt --files '/etc/passwd' --trustAllHosts dcat_notrust: - ../dcat --user fred --key id_rsa_docker --servers serverlist.txt --files '/etc/passwd' + ../dcat --user paul --key id_rsa_docker --servers serverlist.txt --files '/etc/passwd' dmap: - ../dmap --user fred --key id_rsa_docker --servers serverlist.txt --files '/var/log/dserver/*' --trustAllHosts --query 'from stats select avg($$goroutines),max($$goroutines),min($$goroutines),last($$goroutines),count($$hostname),$$hostname group by $$hostname order by avg($$goroutines)' + ../dmap --user paul --key id_rsa_docker --servers serverlist.txt --files '/var/log/dserver/*' --trustAllHosts --query 'from stats select avg($$goroutines),max($$goroutines),min($$goroutines),last($$goroutines),count($$hostname),$$hostname group by $$hostname order by avg($$goroutines)' test: dmap_test dmap2_test dmap_test: - ../dmap --user fred --key id_rsa_docker --servers serverlist.txt --files '/var/log/mapr_testdata.log' --trustAllHosts --query 'from stats select count($$time),last($$time) group by $$time order by count($$time) outfile dmap2-A.csv' - ../dmap --user fred --key id_rsa_docker --servers serverlist.txt --files '/var/log/mapr_testdata.log' --trustAllHosts --query 'from stats select count($$time),last($$time) group by $$time order by count($$time) outfile dmap2-B.csv' + ../dmap --user paul --key id_rsa_docker --servers serverlist.txt --files '/var/log/mapr_testdata.log' --trustAllHosts --query 'from stats select count($$time),last($$time) group by $$time order by count($$time) outfile dmap2-A.csv' + ../dmap --user paul --key id_rsa_docker --servers serverlist.txt --files '/var/log/mapr_testdata.log' --trustAllHosts --query 'from stats select count($$time),last($$time) group by $$time order by count($$time) outfile dmap2-B.csv' @echo Expecting zero diff! diff -u <(sort dmap2-A.csv) <(sort dmap2-B.csv) diff --git a/docker/serverlist.txt b/docker/serverlist.txt index 62a6ea6..8a5d389 100644 --- a/docker/serverlist.txt +++ b/docker/serverlist.txt @@ -8,3 +8,43 @@ localhost:2229 localhost:2230 localhost:2231 localhost:2232 +localhost:2233 +localhost:2234 +localhost:2235 +localhost:2236 +localhost:2237 +localhost:2238 +localhost:2239 +localhost:2240 +localhost:2241 +localhost:2242 +localhost:2243 +localhost:2244 +localhost:2245 +localhost:2246 +localhost:2247 +localhost:2248 +localhost:2249 +localhost:2250 +localhost:2251 +localhost:2252 +localhost:2253 +localhost:2254 +localhost:2255 +localhost:2256 +localhost:2257 +localhost:2258 +localhost:2259 +localhost:2260 +localhost:2261 +localhost:2262 +localhost:2263 +localhost:2264 +localhost:2265 +localhost:2266 +localhost:2267 +localhost:2268 +localhost:2269 +localhost:2270 +localhost:2271 +localhost:2272 diff --git a/internal/clients/baseclient.go b/internal/clients/baseclient.go index 3cd85fe..764d53e 100644 --- a/internal/clients/baseclient.go +++ b/internal/clients/baseclient.go @@ -56,7 +56,7 @@ func (c *baseClient) init() { } c.sshAuthMethods, c.hostKeyCallback = client.InitSSHAuthMethods( c.Args.SSHAuthMethods, c.Args.SSHHostKeyCallback, c.Args.TrustAllHosts, - c.throttleCh, c.Args.SSHPrivateKeyPathFile) + c.throttleCh, c.Args.SSHPrivateKeyFilePath) } func (c *baseClient) makeConnections(maker maker) { diff --git a/internal/config/args.go b/internal/config/args.go index 5b1fc1e..8df6555 100644 --- a/internal/config/args.go +++ b/internal/config/args.go @@ -32,10 +32,10 @@ type Args struct { SSHBindAddress string SSHHostKeyCallback gossh.HostKeyCallback SSHPort int - SSHPrivateKeyPathFile string + SSHPrivateKeyFilePath string Serverless bool ServersStr string - Plain bool + Plain bool Timeout int TrustAllHosts bool UserName string @@ -63,7 +63,7 @@ func (a *Args) String() string { sb.WriteString(fmt.Sprintf("%s:%v,", "SSHAuthMethods", a.SSHAuthMethods)) sb.WriteString(fmt.Sprintf("%s:%v,", "SSHBindAddress", a.SSHBindAddress)) sb.WriteString(fmt.Sprintf("%s:%v,", "SSHHostKeyCallback", a.SSHHostKeyCallback)) - sb.WriteString(fmt.Sprintf("%s:%v,", "SSHPrivateKeyPathFile", a.SSHPrivateKeyPathFile)) + sb.WriteString(fmt.Sprintf("%s:%v,", "SSHPrivateKeyFilePath", a.SSHPrivateKeyFilePath)) sb.WriteString(fmt.Sprintf("%s:%v,", "SSHPort", a.SSHPort)) sb.WriteString(fmt.Sprintf("%s:%v,", "Serverless", a.Serverless)) sb.WriteString(fmt.Sprintf("%s:%v,", "ServersStr", a.ServersStr)) diff --git a/internal/config/initializer.go b/internal/config/initializer.go index 1a7822c..0a8d411 100644 --- a/internal/config/initializer.go +++ b/internal/config/initializer.go @@ -65,7 +65,7 @@ func (in *initializer) parseSpecificConfig(configFile string) error { func (in *initializer) transformConfig(sourceProcess source.Source, args *Args, additionalArgs []string) error { - in.processEnvVars() + in.processEnvVars(args) switch sourceProcess { case source.Server: @@ -80,11 +80,15 @@ func (in *initializer) transformConfig(sourceProcess source.Source, args *Args, } } -func (in *initializer) processEnvVars() { +func (in *initializer) processEnvVars(args *Args) { if Env("DTAIL_INTEGRATION_TEST_RUN_MODE") { os.Setenv("DTAIL_HOSTNAME_OVERRIDE", "integrationtest") in.Server.MaxLineLength = 1024 } + sshPrivateKeyPathFile := os.Getenv("DTAIL_SSH_PRIVATE_KEYFILE_PATH") + if len(sshPrivateKeyPathFile) > 0 && args.SSHPrivateKeyFilePath == "" { + args.SSHPrivateKeyFilePath = sshPrivateKeyPathFile + } } func (in *initializer) optimusPrime(sourceCb transformCb, args *Args, |
