2013-03-07 33 views
3

使用以下命令處理數據後:input |過濾器|輸出> ElasticSearch它獲取存儲在該格式是有點像:在ElasticSearch中省略默認Logstash字段

"_index": "logstash-2012.07.02", 
"_type": "stdin", 
"_id": "JdRaI5R6RT2do_WhCYM-qg", 
"_score": 0.30685282, 
"_source": { 
    "@source": "stdin://dist/", 
    "@type": "stdin", 
    "@tags": [ 
     "tag1", 
     "tag2" 
    ], 
    "@fields": {}, 
    "@timestamp": "2012-07-02T06:17:48.533000Z", 
    "@source_host": "dist", 
    "@source_path": "/", 
    "@message": "test" 
} 

我過濾/店大部分在具體領域的重要信息,是有可能離開了默認的領域,如:@source_path和@source_host?在不久的將來,它將存儲80億日誌/月,我想運行一些性能測試,並且排除這個默認字段(我只是不使用這些字段)。

回答

0

其中的一些將取決於您使用什麼Web界面來查看您的日誌。我使用Kibana,以及客戶記錄器(C#),該指標如下:

{ 
    "_index": "logstash-2013.03.13", 
    "_type": "logs", 
    "_id": "n3GzIC68R1mcdj6Wte6jWw", 
    "_version": 1, 
    "_score": 1, 
    "_source": 
    { 
    "@source": "File", 
    "@message": "Shalom", 
    "@fields": 
    { 
     "tempor": "hit" 
    }, 
    "@tags": 
    [ 
     "tag1" 
    ], 
    "level": "Info" 
    "@timestamp": "2013-03-13T21:47:51.9838974Z" 
    } 
} 

這Kibana顯示出來,並且源字段是不存在的。

+0

我真的不認爲這是Web界面上的依賴性。 我通過ES的REST API檢索此數據時,將數據直接存儲到Logstash的ElasticSearch中,它已經具有這些字段。 – vdevos 2013-03-14 12:11:27

6

這從輸出中刪除字段:

filter { 
    mutate { 
     # remove duplicate fields 
     # this leaves timestamp from message and source_path for source 
     remove => ["@timestamp", "@source"] 
    } 
} 
相關問題