search key support multiple value
This commit is contained in:
parent
e6869549e5
commit
17a4513c01
5
main.go
5
main.go
@ -72,7 +72,9 @@ func tailFile() {
|
|||||||
text = strings.ToLower(text)
|
text = strings.ToLower(text)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ok, _ := regexp.Match(pkg.Opts.KeyWord, []byte(text)); ok {
|
keys := strings.Split(pkg.Opts.KeyWord, ",")
|
||||||
|
for _, key := range keys {
|
||||||
|
if ok, _ := regexp.Match(strings.TrimSpace(key), []byte(text)); ok {
|
||||||
if limiter.IsAvailable() {
|
if limiter.IsAvailable() {
|
||||||
sendMsg(line.Text)
|
sendMsg(line.Text)
|
||||||
} else {
|
} else {
|
||||||
@ -82,3 +84,4 @@ func tailFile() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -10,7 +10,7 @@ var (
|
|||||||
Opts struct {
|
Opts struct {
|
||||||
AppName string `short:"n" long:"monitor-app-name" env:"MONITOR_APP_NAME" description:"The name of the application being monitored, which will be added to the content before"`
|
AppName string `short:"n" long:"monitor-app-name" env:"MONITOR_APP_NAME" description:"The name of the application being monitored, which will be added to the content before"`
|
||||||
File string `short:"f" long:"monitor-file" env:"MONITOR_FILE" description:"The file to be monitored" required:"true"`
|
File string `short:"f" long:"monitor-file" env:"MONITOR_FILE" description:"The file to be monitored" required:"true"`
|
||||||
KeyWord string `short:"k" long:"search-keyword" env:"SEARCH_KEYWORD" description:"Keyword to be search for" default:"ERRO"`
|
KeyWord string `short:"k" long:"search-keyword" env:"SEARCH_KEYWORD" description:"Keyword to be search for, Multiple values separated by ','" default:"ERRO"`
|
||||||
KeyWordIgnoreCase bool `short:"c" long:"keyword-case-sensitive" env:"KEYWORD_IGNORE_CASE" description:"Whether Keyword ignore case"`
|
KeyWordIgnoreCase bool `short:"c" long:"keyword-case-sensitive" env:"KEYWORD_IGNORE_CASE" description:"Whether Keyword ignore case"`
|
||||||
Version bool `short:"v" long:"version" description:"Show version info"`
|
Version bool `short:"v" long:"version" description:"Show version info"`
|
||||||
Robot Robot `group:"DingTalk Robot Options" namespace:"robot" env-namespace:"ROBOT" `
|
Robot Robot `group:"DingTalk Robot Options" namespace:"robot" env-namespace:"ROBOT" `
|
||||||
|
Loading…
Reference in New Issue
Block a user