There are 9 boxes from usppre11 to usppre19
logs are stored in /tmp
$ ls -ltr
-rw-r--r-- 1 admin atg 16455232 Sep 28 17:15 wls_XXX_AdminServer_XXX_stdout.txt.4728104734
-rw-r--r-- 1 admin atg 17439042 Sep 29 08:44 wls_XXX_AdminServer_XXX_stdout.txt.1628171655
-rw-r--r-- 1 admin atg 20182090 Sep 29 16:31 wls_XXX_AdminServer_XXX_stdout.txt.4629084624
-rw-r--r-- 1 admin atg 26107020 Oct 1 15:04 wls_XXX_AdminServer_XXX_stdout.txt.3329163306
-rw-r--r-- 1 admin atg 41899784 Oct 6 13:31 wls_XXX_AdminServer_XXX_stdout.txt.1501171516
grepall.sh
#!/usr/bin/expect -f
#!/bin/bash
# search string
set searchstring [lrange $argv 0 0]
# month MMM format example: Aug
set month [lrange $argv 1 1]
# day dd example 28 or 1
set day [lrange $argv 2 2]
# to list lines - l or just to know the count c
set arg1 [lrange $argv 3 3]
# set password
set pass wlsview
if {${arg1} == "c"} {
set cmd "grep -i ${searchstring} \$(ls -ltr | grep -i '${month}.*${day}.*wls.*AdminServer.*stdout' | sed -n 's/^.*wls/wls/p') | wc -l"
}
if {${arg1} == "l"} {
set cmd "grep -i ${searchstring} \$(ls -ltr | grep -i '${month}.*${day}.*wls.*AdminServer.*stdout' | sed -n 's/^.*wls/wls/p')"
}
for {set i 1} {$i < 10} {incr i 1} {
spawn ssh -o StrictHostKeyChecking=no username@usppre1$i
expect -re "Password:"
send "${pass}\r"
send "cd /tmp\r"
send "${cmd}\r"
send "\r"
send "\r"
send "exit\r"
expect eof
}
#!/bin/bash
# search string
set searchstring [lrange $argv 0 0]
# month MMM format example: Aug
set month [lrange $argv 1 1]
# day dd example 28 or 1
set day [lrange $argv 2 2]
# to list lines - l or just to know the count c
set arg1 [lrange $argv 3 3]
# set password
set pass wlsview
if {${arg1} == "c"} {
set cmd "grep -i ${searchstring} \$(ls -ltr | grep -i '${month}.*${day}.*wls.*AdminServer.*stdout' | sed -n 's/^.*wls/wls/p') | wc -l"
}
if {${arg1} == "l"} {
set cmd "grep -i ${searchstring} \$(ls -ltr | grep -i '${month}.*${day}.*wls.*AdminServer.*stdout' | sed -n 's/^.*wls/wls/p')"
}
for {set i 1} {$i < 10} {incr i 1} {
spawn ssh -o StrictHostKeyChecking=no username@usppre1$i
expect -re "Password:"
send "${pass}\r"
send "cd /tmp\r"
send "${cmd}\r"
send "\r"
send "\r"
send "exit\r"
expect eof
}