# Logstash 7.9.1 file input plugin is not able to read json file

**URL:** https://discuss.elastic.co/t/logstash-7-9-1-file-input-plugin-is-not-able-to-read-json-file/264548
**Category:** Logstash
**Created:** [February 17, 2021, 10:40am UTC](https://discuss.elastic.co/t/logstash-7-9-1-file-input-plugin-is-not-able-to-read-json-file/264548 "2021-02-17T10:40:31Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![sagarpatel](https://avatars.discourse-cdn.com/v4/letter/s/ebca7d/32.png) [@sagarpatel](https://discuss.elastic.co/u/sagarpatel)
#### Post date: [February 17, 2021, 10:40am UTC](https://discuss.elastic.co/t/logstash-7-9-1-file-input-plugin-is-not-able-to-read-json-file/264548/1 "2021-02-17T10:40:31Z")

</div>

I have created sample.conf file for reading json file but it is not showing any output.  
below is my sample.cong file

```auto
input {
	file {
		path => "C:\Users\Sagar\sample.json"
		start_position => "beginning"
		codec => "json"
	}
}
filter{
    json {
        source => "message"
    }
}
output {
	stdout { 
        codec => json 
    }
}

```

below is my json file, it is contains just one value for testing purpose:

```auto
{"nativeId": 1001}

```

Below is logstash log:

```auto
C:\Users\Sagar\ELK\logstash-7.9.1>.\bin\logstash.bat -f .\config\sample.conf
Sending Logstash logs to C:/Users/Sagar/ELK/logstash-7.9.1/logs which is now configured via log4j2.properties
[2021-02-17T15:59:33,433][INFO][logstash.runner] Starting Logstash {"logstash.version"=>"7.9.1", "jruby.version"=>"jruby 9.2.13.0 (2.5.7) 2020-08-03 9a89c94bcc Java HotSpot(TM) 64-Bit Server VM 25.261-b12 on 1.8.0_261-b12 +indy +jit [mswin32-x86_64]"}
[2021-02-17T15:59:33,689][INFO][logstash.setting.writabledirectory] Creating directory {:setting=>"path.queue", :path=>"C:/Users/Sagar/ELK/logstash-7.9.1/data/queue"}
[2021-02-17T15:59:33,704][INFO][logstash.setting.writabledirectory] Creating directory {:setting=>"path.dead_letter_queue", :path=>"C:/Users/Sagar/ELK/logstash-7.9.1/data/dead_letter_queue"}
[2021-02-17T15:59:33,914][WARN][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2021-02-17T15:59:33,996][INFO][logstash.agent] No persistent UUID file found. Generating new UUID {:uuid=>"2de0f081-6c80-4f62-a866-f5404b6d6f71", :path=>"C:/Users/Sagar/ELK/logstash-7.9.1/data/uuid"}
[2021-02-17T15:59:37,157][INFO][org.reflections.Reflections] Reflections took 64 ms to scan 1 urls, producing 22 keys and 45 values
[2021-02-17T15:59:38,021][INFO][logstash.javapipeline][main] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>8, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50, "pipeline.max_inflight"=>1000, "pipeline.sources"=>["C:/Users/Sagar/ELK/logstash-7.9.1/config/sample.conf"], :thread=>"#<Thread:0x68e54919 run>"}
[2021-02-17T15:59:39,175][INFO][logstash.javapipeline][main] Pipeline Java execution initialization time {"seconds"=>1.14}
[2021-02-17T15:59:40,174][INFO][logstash.inputs.file][main] No sincedb_path set, generating one based on the "path" setting {:sincedb_path=>"C:/Users/Sagar/ELK/logstash-7.9.1/data/plugins/inputs/file/.sincedb_2241c9a4d00df54d36f52b07672d9ebc", :path=>["C:\\Users\\Sagar\\sample.json"]}
[2021-02-17T15:59:40,215][INFO][logstash.javapipeline][main] Pipeline started {"pipeline.id"=>"main"}
[2021-02-17T15:59:40,294][INFO][filewatch.observingtail][main][65b2f32534e23b57e62a0d4c276d2cf74b9d94a1edf9b2f80db0699ef82c6301] START, creating Discoverer, Watch with file and sincedb collections
[2021-02-17T15:59:40,303][INFO][logstash.agent] Pipelines running {:count=>1, :running_pipelines=>[:main], :non_running_pipelines=>[]}
[2021-02-17T15:59:41,077][INFO][logstash.agent] Successfully started Logstash API endpoint {:port=>9600}

```

Please let me know if i am missing anything here.

---

<div class="post-metadata">

### Author: ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)
#### Post date: [February 17, 2021, 1:48pm UTC](https://discuss.elastic.co/t/logstash-7-9-1-file-input-plugin-is-not-able-to-read-json-file/264548/2 "2021-02-17T13:48:33Z")

</div>

> [@sagarpatel](#):
>
> `path => "C:\Users\Sagar\sample.json"`

Try `path => "C:/Users/Sagar/sample.json"`

---

<div class="post-metadata">

### Author: ![sagarpatel](https://avatars.discourse-cdn.com/v4/letter/s/ebca7d/32.png) [@sagarpatel](https://discuss.elastic.co/u/sagarpatel)
#### Post date: [February 18, 2021, 5:09am UTC](https://discuss.elastic.co/t/logstash-7-9-1-file-input-plugin-is-not-able-to-read-json-file/264548/3 "2021-02-18T05:09:18Z")

</div>

- I have tried with `path => "C:/Users/Sagar/sample.json"` but is not working.
- converted file to .txt but it is not working.
- added `mode => read` it is not working

everytime i have deleted data folder and try different approach but not working.

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [February 18, 2021, 6:09am UTC](https://discuss.elastic.co/t/logstash-7-9-1-file-input-plugin-is-not-able-to-read-json-file/264548/4 "2021-02-18T06:09:41Z")

</div>

Hi @sagarpatel

Most likely Logstash has already read the file once Logstash keeps track and so will not read it again... No matter how many times you run it. This is a common mistake when getting started

During debug and test you should probably set see [here](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-file.html#plugins-inputs-file-sincedb_path)

`sincedb_path => "/dev/null"`

In the file input section.

Or you can erase the since DB data every time but the` /dev/null` setting is easier

Also you don't need the multilpe json parsing... For a file with ndjson take it out of the json codec in the file input and just use the json filter.

In the output the just use the rubydebug

```
output {
      stdout { codec => rubydebug }
    }
```

---

<div class="post-metadata">

### Author: ![sagarpatel](https://avatars.discourse-cdn.com/v4/letter/s/ebca7d/32.png) [@sagarpatel](https://discuss.elastic.co/u/sagarpatel)
#### Post date: [February 19, 2021, 6:33am UTC](https://discuss.elastic.co/t/logstash-7-9-1-file-input-plugin-is-not-able-to-read-json-file/264548/5 "2021-02-19T06:33:31Z")

</div>

I have tried below configuration as i am running logstash 7.9.1 on **windows**. But it is still not printing anything on log or prompt. one more thing i have noticed that [logstash 7.9.1 download page](https://www.elastic.co/downloads/past-releases/logstash-7-9-1) not showing OS based download link, that means is it supporting only Linux ? because i can see OS based [download for 7.10.x version](https://www.elastic.co/downloads/past-releases/logstash-7-10-0).

```auto
input {
	file {
		path => "C:/Users/Sagar/sample.txt"
		start_position => "beginning"
		sincedb_path => "NUL"
	}
}
filter{
    json {
        source => "message"
    }
}
output {
	stdout { codec => rubydebug }
}

```

---

<div class="post-metadata">

### Author: ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)
#### Post date: [February 19, 2021, 1:44pm UTC](https://discuss.elastic.co/t/logstash-7-9-1-file-input-plugin-is-not-able-to-read-json-file/264548/6 "2021-02-19T13:44:17Z")

</div>

Can you post your Logstash output again to see if anything changed?

---

<div class="post-metadata">

### Author: ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)
#### Post date: [February 19, 2021, 3:25pm UTC](https://discuss.elastic.co/t/logstash-7-9-1-file-input-plugin-is-not-able-to-read-json-file/264548/7 "2021-02-19T15:25:40Z")

</div>

@sagarpatel

To answer your question Yes Logstash 7.9 is supported on Windows Server 2016 and Windows Server 2019.

How are you starting logstash?

and as @aaron-nimocks asked can you please post your logstash output?

There is something basic going on... like a typo in the path perhaps... the config about should just read the file... is there more than 1 line in the file?

---

<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: [March 19, 2021, 3:26pm UTC](https://discuss.elastic.co/t/logstash-7-9-1-file-input-plugin-is-not-able-to-read-json-file/264548/8 "2021-03-19T15:26:32Z")

</div>

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