我在一个数组中有Json日志,如下所示:
label
a 3
b 1
c 2
dtype: int64
我想从数组中删除前3个元素,并使用过滤器保留最后4个元素。
我将此作为我的过滤器:
e":[{"n":"3/0/1","st":"CONTENT","v":"Sensortag"},
{"n":"3/0/3","st":"CONTENT","v":"Contiki-develop-20150508-409-g2147b9e"},
{"n":"3/0/13","st":"CONTENT","v":"1970-01-09T21:02:18Z"},
{"n":"3301/0/5700","st":"CONTENT","v":"376.64"},
{"n":"3303/0/5700","st":"CONTENT","v":"22.843"},
{"n":"3304/0/5700","st":"CONTENT","v":"63.53"},
{"n":"3315/0/5700","st":"CONTENT","v":"1000.34"}]
但Logstash将自己置于错误
答案 0 :(得分:0)
你可以使用Ruby过滤器,例如删除前三个元素:
filter {
ruby {
code => "event['MessageParserJson'].slice!(0,3)"
}
}
干杯