# Logstash parse JSON ARRAY

**URL:** <https://discuss.elastic.co/t/logstash-parse-json-array/172648>\
**Category:** Discussions en français\
**Created:** [March 16, 2019, 6:08pm UTC](https://discuss.elastic.co/t/logstash-parse-json-array/172648 "2019-03-16T18:08:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elastock](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elastock/32/35672_2.png) [@elastock](https://discuss.elastic.co/u/elastock)\
**Post date:** [March 16, 2019, 6:08pm UTC](https://discuss.elastic.co/t/logstash-parse-json-array/172648/1 "2019-03-16T18:08:26Z")

</div>

Bonjour ,  
Avec le logstash je suis en train de parser des données issues d'un fichier JSON .  
Jusque la rien de transcendant , cependant il y a quelque chose qui m'échappe .  
Je m'explique :  
J'ai un fichier JSON qui ressemble à ça

> ```
> [
> {
> "reference": "2-4",
> "title": "transition écologique",
> "createdAt": "2019-01-22 09:37:49",
> "publishedAt": "2019-01-22 09:37:49",
> "updatedAt": null,
> "trashed": false,
> "trashedStatus": null,
> "authorId": "VXNlcjoxMTQwMTc0YS0xZTFmLTExZTktOTRkMi1mYTE2M2VlYjExZTE=",
> "authorType": "henri stratowen",
> "authorZipCode": "97231"
> },
> {
> "reference": "2-4",
> "title": "qsdefrqsdfqsd",
> "createdAt": "2019-01-22 09:37:49",
> "publishedAt": "2019-01-22 09:37:49",
> "updatedAt": null,
> "trashed": false,
> "trashedStatus": null,
> "authorId": "VXNlcjoxMTQwMTc0YS0xZTFmLTExZTktOTRkMi1mYTE2M2VlYjExZTE=",
> "authorType": "arnold schwarzeneger ",
> "authorZipCode": "97231"
> }
> ]
> 
> ```

C'est a dire que c'est un tableau JSON qui comprend des objets json non identifié  
Grossièrement =\>

`> [{},{},{}]`

En phase préliminaire j'ecrit la conf logstash suivante 🙂

```
input {

file {

path => ["C:\ELK\Logstash\logstash-6.6.2\conf\lefichier.json"]

sincedb_path =>"nul"

start_position => "beginning"

}

}

filter {

}

output {

stdout {

codec => rubydebug

}

}

```

Lorsque je lance cette conf de la manière suivante :

> ```
> C:\ELK\Logstash\logstash-6.6.2\bin\logstash.bat -f C:\ELK\Logstash\logstash-6.6.2\conf\indexlocal.conf
> Sending Logstash logs to C:/ELK/Logstash/logstash-6.6.2/logs which is now configured via log4j2.properties
> [2019-03-16T18:58:05,929][WARN][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
> [2019-03-16T18:58:05,949][INFO][logstash.runner] Starting Logstash {"logstash.version"=>"6.6.2"}
> [2019-03-16T18:58:17,602][INFO][logstash.pipeline] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>4, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50}
> [2019-03-16T18:58:18,461][INFO][logstash.pipeline] Pipeline started successfully {:pipeline_id=>"main", :thread=>"#<Thread:0x1df6669 sleep>"}
> [2019-03-16T18:58:18,533][INFO][logstash.agent] Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>[]}
> [2019-03-16T18:58:18,533][INFO][filewatch.observingtail] START, creating Discoverer, Watch with file and sincedb collections
> [2019-03-16T18:58:19,178][INFO][logstash.agent] Successfully started Logstash API endpoint {:port=>9600}
> 
> ```

Il ne se passe rien apres Successfully started Logstash API endpoint {:port=\>9600}  
J'ai verifié que la conf etait correct avec l'option -t  
Est-ce normal , j'ai l'impression que quelque chose m'échappe .  
Par defaut , cette configuration logstash ne devrait-elle pas me répondre mon fichier JSON en sortie ?  
J'utilise logstash 6.6.2 sur windows(je sais , c'est très précaire ....) .

Merci de votre aide

---

<div class="post-metadata">

**Author:** ![elastock](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/elastock/32/35672_2.png) [@elastock](https://discuss.elastic.co/u/elastock)\
**Post date:** [March 16, 2019, 6:20pm UTC](https://discuss.elastic.co/t/logstash-parse-json-array/172648/2 "2019-03-16T18:20:33Z")

</div>

Bon finalement , problème résolu ,  
il fallait changer le path comme ceci  
`

> path =\> ["C:/ELK/Logstash/logstash-6.6.2/conf/LA\_TRANSITION\_ECOLOGIQUE\_SMALL.json"]

en inversant les `\` en

> /

Et

> sincedb\_path =\> "NUL"

au lieu de

> sincedb\_path =\> "nul"

Autant pour moi

---

<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:** [April 13, 2019, 6:34pm UTC](https://discuss.elastic.co/t/logstash-parse-json-array/172648/3 "2019-04-13T18:34:32Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
