2016-12-20 1 views
0

J'utilise ingest-attachment pour obtenir les données du champ base64.Configurer la fixation élastique du pipeline en configuration logstash?

PUT _ingest/pipeline/attachment 
{ 
    "description" : "Extract attachment information", 
    "processors" : [ 
    { 
     "attachment" : { 
     "field" : "data" 
     } 
    } 
    ] 
} 



PUT my_index/my_type/my_id?pipeline=attachment 
{ 
    "data": "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0=" 
} 

GET my_index/my_type/my_id 

{ 
    "found": true, 
    "_index": "my_index", 
    "_type": "my_type", 
    "_id": "my_id", 
    "_version": 1, 
    "_source": { 
    "data":  "e1xydGYxXGFuc2kNCkxvcmVtIGlwc3VtIGRvbG9yIHNpdCBhbWV0DQpccGFyIH0=", 
"attachment": { 
    "content_type": "application/rtf", 
    "language": "ro", 
    "content": "Lorem ipsum dolor sit amet", 
    "content_length": 28 
    } 
    } 
} 

Comment faire la même chose avec le fichier de configuration de Logstash? Je n'ai vu aucune référence pour définir la connexion de pipeline.

Répondre

1

Il vous suffit de spécifier which pipeline to use dans votre configuration de sortie elasticsearch, afin que votre événement est traité par le pipeline approprié, comme celui-ci:

output { 
    elasticsearch { 
     hosts => ["localhost:9200"] 
     index => "my_index" 
     document_type => "my_type" 
     pipeline => "attachment"    <--- use this 
    } 
} 

PS: Notez que cela ne fonctionnera que sur les ES 5 et Logstash 5.

+0

Une chance avec cela? – Val

+0

Exactement ce que j'ai utilisé pour mon projet. Merci – srinisunka