日志事件过滤 & 动作触发相关 #3140
gito10
started this conversation in
Show and tell
日志事件过滤 & 动作触发相关
#3140
Replies: 3 comments 2 replies
-
|
老哥,实例在哪了,急用!!!! |
Beta Was this translation helpful? Give feedback.
1 reply
-
AnPush 推送AnPush 支持 GET 和 POST 两种请求,因为请求内容也不复杂,模板直接就使用GET来请求了。 token= #填入自己的Token
channel= #填入推送通道ID
title="Passwall Notification" #推送标题,支持空格,后面有处理,但是符号应该不行,因为没有进行URL转码
#转码标题空格
title=$(echo -n $title | sed "s/ /+/g")
#日志内容URL转码
content=$(echo -n $@ | curl -Gso /dev/null -w %{url_effective} --data-urlencode @- "" | cut -c 3-)
#CURL GET 请求
curl --location --request GET "https://api.anpush.com/push/$token?title=$title&content=$content&channel=$channel" |
Beta Was this translation helpful? Give feedback.
0 replies
-
Bark 推送Bark 跟 AnPush 差不多,也是支持 GET 和 POST 两种请求,而且请求 URL 更简单,但是 Bark 开源,支持自己搭建服务,所以多一个服务器选项。 server=api.day.app #服务器,如果自己有搭建,修改为自己的服务器地址
key= #填入自己的Key
title="Passwall Notification" #推送标题,支持空格,后面有处理,但是符号应该不行,因为没有进行URL转码
#转码标题空格
title=$(echo -n $title | sed "s/ /+/g")
#日志内容URL转码
content=$(echo -n $@ | curl -Gso /dev/null -w %{url_effective} --data-urlencode @- "" | cut -c 3-)
#CURL GET 请求
curl --location --request GET "https://$server/$key/$title/$content" |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
新增的日志事件过滤,暂时只支持Socks自动切换的日志,根据自己需要监测的内容,设置合适的正则表达式来筛选特定的日志。当满足筛选条件的日志事件发生时,会执行设定的shell 命令,可以直接设置命令,也可以设置脚本文件。
过滤器命中的日志内容,用%s代替。
下面会慢慢增加一些实例,为防部分用户不会用,简单说明下:
/root)新建一个 .sh 后缀的文件,比如AnPush的就叫 anpush.sh,Bark的就叫 bark.sh,或者随意;chmd +x /path/to/script.sh。日志事件过滤器 填上需要筛选的关键词或者正则表达式;
Shell 命令 填上脚本路径,后面空格再加上一个 %s。比如脚本路径为 /root/example.sh,那么就填
/root/example.sh %s。如果下面实例中目前没有所需的,有能力动手的,可以自己实现或者照着现有的脚本代码自己修改适配,实现成功了,可以把脚本发上来。
自己不会改的,需要别人帮忙适配的,直接在这个Comment 下面回复,不要单开一个Comment。
Beta Was this translation helpful? Give feedback.
All reactions