首页 > 其他分享 >vector 初步学习记录

vector 初步学习记录

时间:2022-09-20 21:37:42浏览次数:69  
标签:parse search 记录 slowlog 初步 vector elasticsearch type es

cat /etc/vector/vector.toml
[sources.elasticsearch_search_slowlog]
type         = "file"
include      = ["/var/log/elasticsearch/picapica_es_index_search_slowlog*.log", "/var/log/elasticsearch_2nd/picapica_es_index_search_slowlog*.log", ]
#read_from    = "end"
read_from    = "beginning"   #是否获取之前的日志进行格式化


[transforms.elasticsearch_search_slowlog_parse]
type         = "remap"
inputs       = ["elasticsearch_search_slowlog"]
source = """
. |= parse_regex!(.message, r'^\\[(?P<timestamp>\\S+)\\]\\[(?P<log_level>\\S+)\\s+\\]\\[(?P<query_type>\\S+)\\] \\[(?P<instance>\\S+)\\] \\[(?P<query_index>\\S+)\\]\\[(?P<query_shard>\\d+)\\] took\\[(?P<delay_time>\\d+\\.{0,1}\\d*)(?P<delay_time_unit>\\S+)\\], took_millis\\[(?P<delay_time_millis>\\d+)\\], total_hits\\[(?P<hit>\\d+)\\+{0,1} hits\\], \\S+, \\S+, search_type\\[(?P<search_type>\\S+)\\], total_shards\\[(?P<search_shard_num>\\S+)\\], source\\[(?P<source>\\S+( \\S+)*)\\], id\\[\\]')
#. |= parse_regex!(.message, r'^\\[(?P<timestamp>\\S+)\\]\\[(?P<log_level>\\S+) \\]\\[(?P<query_type>\\S+)\\] \\[(?P<instance>\\S+)\\] \\[(?P<query_index>\\S+)\\]\\[(?P<query_shard>\\S+)\\] took\\[(?P<delay_time>\\d+\\.{0,1}\\d*)(?P<delay_time_unit>\\S+)\\], took_millis\\[(?P<delay_time_millis>\\S+)\\], total_hits\\[(?P<hit>\\S+) hits\\], types\\[\\], stats\\[\\], search_type\\[(?P<search_type>\\S+)\\], total_shards\\[(?P<search_shard_num>\\S+)\\], id\\[\\]')
#. |= parse_regex!(.message, r'^\\[(?P<timestamp>\\S+)\\]\\[(?P<level>\\S+) \\]\\[(?P<query_type>\\S+)\\] \\[(?P<instance>\\S+)\\] \\[(?P<index>\\S+)\\]\\[(?P<shard>\\S+)\\] took\\[(?P<delay_time>\\S+)\\], took_millis\\[(?P<delay_time_millis>\\S+)\\], total_hits\\[(?P<hit>\\S+) hits\\], types\\[\\], stats\\[\\], search_type\\[(?P<search_type>\\S+)\\], total_shards\\[(?P<search_shard_num>\\S+)\\], source\\[(?P<source>\\S+)\\], id\\[\\]')
.timestamp = parse_timestamp(.timestamp, "%Y-%m-%d %H:%M:%S,%z") ?? now()
.input_ip = "10.x.6.x"
.cluster = "picapica-es"
.delay_time = to_float!(.delay_time)
del(.message)
del(.file)
#drop_on_error= true   # 打开就是忽略不匹配的日志
"""

[sinks.bigdata_es]
inputs       = ["elasticsearch_search_slowlog_parse"]
type         = "elasticsearch"
endpoint     = "http://elasticsearch.com:80"

[sinks.bigdata_es.auth]
user         = "elastic"
password     = "123pws"
strategy     = "basic"
[sinks.bigdata_es.bulk]
index        = "bigdata-elasticsearch-index-slowlog-%Y.%m"

## 以下是开启打印到日志,进行调试josn是否合适
#[sinks.my_sink_id]
#type = "console"
#inputs = [ "elasticsearch_search_slowlog_parse" ]
#target = "stdout"
#
#[sinks.my_sink_id.encoding]
#codec = "json"

标签:parse,search,记录,slowlog,初步,vector,elasticsearch,type,es
From: https://www.cnblogs.com/x602/p/16712611.html

相关文章

  • 【做题记录】CF878E
    让正数带的系数尽量大。如果要使系数最小的话,全部从左往右合并,可以让除了左端点之外全部系数为\(2\)。如果增大系数可以考虑先右再左。那么实际上就是分成若干组,组内......
  • 数据库课堂学习记录
    建表插入数据      创建连线  错误原因:忘记设置主键了   在MySQL的命令行工具里 输入SHOWVARIABLESLIKE'datadir';命令,返回数据库文......
  • 思维题做题记录
    博弈论-CF1728D先明确一些事情:对于str[l,r],若A先手,最后的结果是确定的。(这里的字符串长度为偶数)现在,我们设\(f_{l,r}\)表示对于字符串[l,r],A先手的博弈......
  • 前端基础知识-css(一)个人学习记录
    待补充flex及其属性https://blog.csdn.net/weixin_44706267/article/details/121291934css3新特性sass和lesshttps://www.cnblogs.com/dasusu/p/10114097.html......
  • 做题记录整理dp3 P1108. 低价购买(2022/9/20)
    P1108.低价购买第一问很明显是一个最长下降子序列第二问就是一个求方案数,有点难想的就是去重感觉这题难度标的有点偏高#include<bits/stdc++.h>#definefor1(i,a,b)......
  • 做题记录整理dp1 P1282. 多米诺骨牌(2022/9/20)
    P1282.多米诺骨牌我们可以把每张骨牌的差值塞进dp的维度了,就变成dpi,j表示前i块骨牌的差值为j的最小旋转次数就可以有递推方程dp[i,j]=max(dp[i-1,j-(a[i]-b[i])],dp[i......
  • 做题记录整理dp1 P1541. [NOIP2010 提高组] 乌龟棋(2022/9/20)
    P1541.[NOIP2010提高组]乌龟棋把每个牌选多少个塞进dp的四个维度里,就可以做到无后效性了#include<bits/stdc++.h>usingnamespacestd;#definefor1(i,a,b)for(ll......
  • D8加密狗的使用过程记录
    1、安装VSCode,并且安装插件   2、打开商家给提供的文件夹【打开的是整个文件夹】如下: 打开后效果如下: 3、编写加密锁里的逻辑打......
  • 做题记录整理线段树2 P4513. 小白逛公园(2022/9/20)
    P4513.小白逛公园我们思考一个如何使用线段树维护这个答案,会发现l.r的答案=max(l,mid的答案,mid+1,r的答案,横跨两个区间的答案)那么我们现在再引入一个区间的最大前缀......
  • 浅学vector
    vectorvector的作用vector作为一种stl,能作为一种数组使用,和数组不同的地方在于,vector本身能支持动态的空间存储,在存入时确保了空间的动态增长。vector的插入在vector的......