# Problème d'indexation Elastic sur des csv

**URL:** <https://discuss.elastic.co/t/probleme-dindexation-elastic-sur-des-csv/40107>\
**Category:** Discussions en français\
**Created:** [January 26, 2016, 9:54am UTC](https://discuss.elastic.co/t/probleme-dindexation-elastic-sur-des-csv/40107 "2016-01-26T09:54:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![C\_H](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/c_h/32/20796_2.png) [@C\_H](https://discuss.elastic.co/u/C_H)\
**Post date:** [January 26, 2016, 9:54am UTC](https://discuss.elastic.co/t/probleme-dindexation-elastic-sur-des-csv/40107/1 "2016-01-26T09:54:21Z")

</div>

Bonjour,

j'ai installé le trio ELK sur un RHEL et je cherche à indexer des fichiers csv.

Mon CSV est fait ainsi :  
`s00va9924890;TSM-ARZ109;2016/01/23;02:02:40;00:01:12;48504;234;0;53.07;76%;0.0597949;;;TSM_backup_INCR_APPLI_20160123_18874576.log;;INCR_APPLI;dsm.opt.incr;v5.0.2`

Ma conf Logstash :

> input {  
> file {  
> path =\> "/apps/logstash/input/sibr/_.crs._.csv"  
> start\_position =\> beginning  
> }  
> }

> filter {  
> csv {  
> columns =\> [  
> "HOSTNAME",  
> "INSTANCE",  
> "DATE\_INJECTION",  
> "HEURE\_INJECTION",  
> "DUREE",  
> "INSPECTED",  
> "BACKUP",  
> "FAILED",  
> "TRANSFERT\_TIME",  
> "TAUX\_CP",  
> "VOLUME",  
> "SAUVE",  
> "CLASSARCH",  
> "LOG",  
> "APP\_SAVE",  
> "SAVE\_MODE",  
> "DSM\_OPT",  
> "VER\_SCRIPTS"  
> ]  
> separator =\> ";"  
> remove\_field =\> ["message","host","path","@version","@timestamp"]  
> }  
> mutate {  
> convert =\> ["LOG", "string"]  
> }  
> mutate {  
> lowercase =\> ["HOSTNAME"]  
> }  
> }

> output {  
> elasticsearch {  
> hosts =\> "localhost"  
> action =\> "index"  
> index =\> "sibr"  
> }

> stdout {  
> codec =\> rubydebug  
> }  
> }

Je créé mon index via Sense :

> PUT sibr  
> {  
> "mappings": {  
> "logs": {  
> "properties": {  
> "DATE\_INJECTION": {  
> "type": "date",  
> "format": "yyyy/MM/dd",  
> "ignore\_malformed": true  
> },  
> "HEURE\_INJECTION": {  
> "type": "date",  
> "format": "HH:mm:ss"  
> },  
> "DUREE": {  
> "type": "date",  
> "format": "HH:mm:ss",  
> "ignore\_malformed": true  
> },  
> "TRANSFERT\_TIME": {  
> "type": "date",  
> "format": "ss.SSS",  
> "ignore\_malformed": true  
> },  
> "VOLUME": {  
> "type": "float",  
> "ignore\_malformed": true  
> },  
> "FAILED": {  
> "type": "integer",  
> "ignore\_malformed": true  
> },  
> "INSPECTED": {  
> "type": "float",  
> "ignore\_malformed": true  
> },  
> "BACKUP": {  
> "type": "integer",  
> "ignore\_malformed": true  
> }  
> }  
> }  
> }  
> }

Puis je lance l'importation dans Elastic via Logstash de manière classique :

> bin/logstash -f conf/logstash.conf --verbose

Mais arrive un moment où l'indexation du contenu du csv se décale, et la ça devient n'importe quoi. Par exemple :

```
[2016-01-26 10:29:09,594][DEBUG][action.bulk] [s00vl9931488] [sibr][4] failed to execute bulk item (index) index {[sibr][logs][AVJ9Q-yliY-Gr-iuz-Pp], source[{"HOSTNAME":"cr_appli","INSTANCE":"dsm.opt.incr","DATE_INJECTION":"v5.0.3"}]}
MapperParsingException[failed to parse [DATE_INJECTION]]; nested: IllegalArgumentException[Invalid format: "v5.0.3"];

```

Aussi je ne retrouve pas mon mapping après l'indexation :

> GET sibr/\_mappings  
> {  
> "sibr": {  
> "mappings": {  
> "logs": {  
> "properties": {  
> "@timestamp": {  
> "type": "date",  
> "format": "strict\_date\_optional\_time||epoch\_millis"  
> },  
> "@version": {  
> "type": "string"  
> },  
> "APP\_SAVE": {  
> "type": "string"  
> },  
> "BACKUP": {  
> "type": "string"  
> },  
> "CLASSARCH": {  
> "type": "string"  
> },  
> "DATE\_INJECTION": {  
> "type": "date",  
> "format": "yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||epoch\_millis"  
> },  
> "DSM\_OPT": {  
> "type": "string"  
> },  
> "DUREE": {  
> "type": "string"  
> },  
> "FAILED": {  
> "type": "string"  
> },  
> "HEURE\_INJECTION": {  
> "type": "string"  
> },  
> "HOSTNAME": {  
> "type": "string"  
> },  
> "INSPECTED": {  
> "type": "string"  
> },  
> "INSTANCE": {  
> "type": "string"  
> },  
> "LOG": {  
> "type": "string"  
> },  
> "SAUVE": {  
> "type": "string"  
> },  
> "SAVE\_MODE": {  
> "type": "string"  
> },  
> "TAUX\_CP": {  
> "type": "string"  
> },  
> "TRANSFERT\_TIME": {  
> "type": "string"  
> },  
> "VER\_SCRIPTS": {  
> "type": "string"  
> },  
> "VOLUME": {  
> "type": "string"  
> },  
> "host": {  
> "type": "string"  
> },  
> "message": {  
> "type": "string"  
> },  
> "path": {  
> "type": "string"  
> },  
> "tags": {  
> "type": "string"  
> }  
> }  
> }  
> }  
> }  
> }

---

<div class="post-metadata">

**Author:** ![C\_H](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/c_h/32/20796_2.png) [@C\_H](https://discuss.elastic.co/u/C_H)\
**Post date:** [January 26, 2016, 6:48pm UTC](https://discuss.elastic.co/t/probleme-dindexation-elastic-sur-des-csv/40107/2 "2016-01-26T18:48:12Z")

</div>

Pour une raison que j'ignore, j'ai réussi à faire une importation sans accroc, avec toutes mes données à l'arrivée tel que je le souhaitais.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:49pm UTC](https://discuss.elastic.co/t/probleme-dindexation-elastic-sur-des-csv/40107/3 "2017-07-06T13:49:52Z")

</div>


