小编Err*_*0rr的帖子

如何在logstash中进行两个条件检查并编写更好的配置文件

我正在使用logstash 1.4.2,

我在客户端日志服务器中有logstash-forwarder.conf,就像这样

{
    "network": {
      "servers": [ "xxx.xxx.xxx.xxx:5000" ],
      "timeout": 15,
      "ssl ca": "certs/logstash-forwarder.crt"
    },
  "files": [
       {
          "paths": [ "/var/log/messages" ],
          "fields": { "type": "syslog" }
        },
        {

          "paths": [ "/var/log/secure" ],
          "fields": { "type": "linux-syslog" }
        }
         ]
}
Run Code Online (Sandbox Code Playgroud)

================================================== =======

在logstash服务器中

1. filter.conf

filter {
  if [type] == "syslog" {
date {
        locale => "en"
        match => ["syslog_timestamp", "MMM  d HH:mm:ss", "MMM dd HH:mm:ss"]
        timezone => "Asia/Kathmandu"
        target => "@timestamp"
        add_field => { "debug" => "timestampMatched"} …
Run Code Online (Sandbox Code Playgroud)

logstash kibana

7
推荐指数
1
解决办法
2万
查看次数

在python的字典中如果存储了多个值,如何打印键的值?

我已经定义了如下的dict:

a = { "b" : [20,40,45]}
Run Code Online (Sandbox Code Playgroud)

该命令a['b']将打印所有值,如下所示

[20, 40, 45]
Run Code Online (Sandbox Code Playgroud)

.我只想要一个价值.如何在值中获得b的单个值?我要做什么打印让我们说45?

我现在能做的是:

d = a['b']
print d[2]
Run Code Online (Sandbox Code Playgroud)

如何在一行中完成?

python

1
推荐指数
1
解决办法
72
查看次数

标签 统计

kibana ×1

logstash ×1

python ×1