-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlog_it_filter.sh
executable file
·53 lines (44 loc) · 1.51 KB
/
log_it_filter.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
clear
### Global Variables ###
#CurrentDirectory=`pwd`
DATE_TIME=`date '+%m%d_%H%M%S'`
NewLogDirectory="/home/ngsuser/myPlayGround/log-collection/log/$DATE_TIME"
ZookeeperLog="/home/ngsuser/var/log/zookeeper/zookeeper-1/zookeeper.log"
SolrLog8985="/home/ngsuser/var/log/solr/solr-rps_product_cluster1_1/8985/solr.log"
SolrLog8983="/home/ngsuser/var/log/solr/solr-rps_product_cluster1_1/8983/solr.log"
HttpgatewayLog="/home/ngsuser/var/log/httpgateway/httpgateway-1/httpgateway.log"
IndexerLog="/home/ngsuser/var/log/indexer/indexer-rps_product_cluster1_1/indexer.log"
CassandraLog="/home/ngsuser/var/log/cassandra/node0/system.log"
CatalinaLog="/home/ngsuser/var/log/searchapi/searchapi-rps_product_cluster1_1/catalina.out"
#SearchapiLog="/home/ngsuser/var/log/searchapi/searchapi-rps_product_cluster1_1/SearchAPI/access.log.`date '+%Y-%m-%d'`"
### Log File Function ###
log_it()
{
file="$NewLogDirectory/$1";
log="$2";
echo $log >> $file
}
log_component()
{
NewLogName=$1;
ComponentLog=$2;
echo $ComponentLog
tail -fn0 $ComponentLog | while read line ; do
echo "$line" > grep ""
if [ $?=0 ]; then
log_it "$NewLogName.log" "$line"
fi
done &
}
### Main Process ###
mkdir $NewLogDirectory
cd $NewLogDirectory
log_component "zookeeper" $ZookeeperLog
log_component "solr8985" $SolrLog8985
log_component "solr8983" $SolrLog8983
log_component "httpgateway" $HttpgatewayLog
log_component "indexer" $IndexerLog
log_component "catalina" $CatalinaLog
log_component "cassandra" $CassandraLog
#cd $CurrentDirectory