action为toggle的情况
This commit is contained in:
parent
5df3bb2449
commit
ebea1ced99
|
@ -56,7 +56,20 @@ $0~/condition set is ok,then execute action set\./ {
|
|||
|
||||
$0~/action<[0-9]+> is dp cmd:/ {
|
||||
atime = match($0,/[0-9]{1,2}-[0-9]{1,2} ([0-9]{1,2}:){3}[0-9]{1,3}/) ? substr($0,RSTART,RLENGTH) : null;
|
||||
adps = match($0,/cmd:\{\".+\}/) ? substr(substr($0,RSTART,RLENGTH),5,RLENGTH-4) : ""$0;
|
||||
adps = match($0,/cmd:\{\".+\}\}/) ? substr(substr($0,RSTART,RLENGTH),5,RLENGTH-4) : ""$0;
|
||||
|
||||
aLogJson = "{ \"time\":"atime", \"event\":\"action\", \"cmd\":"adps"}"
|
||||
log2file(aLogJson)
|
||||
}
|
||||
|
||||
$0~/action<[0-9]+> is toggle./ {
|
||||
atime = match($0,/[0-9]{1,2}-[0-9]{1,2} ([0-9]{1,2}:){3}[0-9]{1,3}/) ? substr($0,RSTART,RLENGTH) : null;
|
||||
|
||||
if((getline conditionLine) > 0){
|
||||
adps = match(conditionLine,/toggle action: \{.*\}\}/) ? substr(substr($0,RSTART,RLENGTH),16,RLENGTH-15) : "\"not substr cmd\""
|
||||
}else{
|
||||
print "no more line"
|
||||
}
|
||||
|
||||
aLogJson = "{ \"time\":"atime", \"event\":\"action\", \"cmd\":"adps"}"
|
||||
log2file(aLogJson)
|
||||
|
@ -83,7 +96,7 @@ function splitAndUpload(){
|
|||
newFileName = "mySimpleLog_"systime()
|
||||
print "uploading..."
|
||||
|
||||
ret = system("mv /data/log_dir/mySimpleLog /data/log_dir/"newFileName" && cd /data/log_dir/ && tftp "upload_ip" -p -l "newFileName" > /dev/null && rm "newFileName)
|
||||
ret = system("mv /data/log_dir/mySimpleLog /data/log_dir/"newFileName" && cd /data/log_dir/ && tftp "upload_ip" -pr "newFileName" > /dev/null && rm /data/log_dir/"newFileName"")
|
||||
if(!ret){
|
||||
print "upload success!"
|
||||
uploadCount++
|
||||
|
@ -92,6 +105,14 @@ function splitAndUpload(){
|
|||
}
|
||||
}
|
||||
|
||||
function doMoreLine(){
|
||||
if((getline conditionLine) > 0){
|
||||
adps = match(conditionLine,/toggle action: \{.*\}\}/) ? substr(substr($0,RSTART,RLENGTH),16,RLENGTH-15) : "\"unkown\""
|
||||
}else{
|
||||
print "no more line"
|
||||
}
|
||||
}
|
||||
|
||||
function notify2python(){
|
||||
# system("curl http://"upload_ip"/api")
|
||||
}
|
Loading…
Reference in New Issue