# JSON File Input

**URL:** https://discuss.elastic.co/t/json-file-input/100916
**Category:** Logstash
**Created:** [September 18, 2017, 6:34pm UTC](https://discuss.elastic.co/t/json-file-input/100916 "2017-09-18T18:34:54Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Pratiksha\_Tewary](https://avatars.discourse-cdn.com/v4/letter/p/a88e4f/32.png) [@Pratiksha\_Tewary](https://discuss.elastic.co/u/Pratiksha_Tewary)
#### Post date: [September 18, 2017, 6:34pm UTC](https://discuss.elastic.co/t/json-file-input/100916/1 "2017-09-18T18:34:54Z")

</div>

Hi,  
I am just trying to take in a JSON file and spit it out to the stdout. The pipeline starts and nothing happens after that. There are no error messages and no other movements. I have the following in my configuration file:

input {  
file {  
type =\> "json"  
path =\> "/opt/bin/samplejson\_single.json"  
start\_position =\> "beginning"  
sincedb\_path =\> "/dev/null"  
}  
}

filter {  
json {  
source =\> "message"  
}  
}

output {  
stdout {}  
}

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [September 18, 2017, 10:44pm UTC](https://discuss.elastic.co/t/json-file-input/100916/2 "2017-09-18T22:44:49Z")

</div>

> [@Pratiksha\_Tewary](#):
>
> The pipeline starts and nothing happens after that.

Please show the command you are running and any applicable logs/output.

---

<div class="post-metadata">

### Author: ![Pratiksha\_Tewary](https://avatars.discourse-cdn.com/v4/letter/p/a88e4f/32.png) [@Pratiksha\_Tewary](https://discuss.elastic.co/u/Pratiksha_Tewary)
#### Post date: [September 19, 2017, 1:21am UTC](https://discuss.elastic.co/t/json-file-input/100916/3 "2017-09-19T01:21:03Z")

</div>

![logstash_screenshot](https://us1.discourse-cdn.com/elastic/original/3X/9/f/9feb0e85be44d8aa6826e4143aef397ad0554a21.PNG)

The contents of samplejson\_single.json are:

{"prodId":"00583BE8-BE33-E011-BF97-001018721196","vendorName":"Omega","vendorId":"212770E7-E633-E011-BF97-001018721196","model":"DishStarÂ®","categoryName":"Blender, Food, Countertop","fob":{"city":"Ft. Lauderdale","state":"FL","zip":"33331"},"spec":"Omega Blender, 48 oz. Tritan coopolyester BPA-Free container, toggle control with high/low speed, heavy duty locking ring, recessed coupling system, removable stainless steel blade assembly, silver, 1 HP, 600 watts, CE, ETL","listPrice":164.0,"netPrice":0.0,"numPerCase":1,"sellingUnit":"ea","shippingCube":0.0,"shippingWeight":7.0,"freightClass":"85","height":15.5,"width":8.0,"depth":7.0,"catalogItem":true,"multiplier":0,"hideModel":false,"callForPricing":false,"pictureId":"9B6AC60C-CF96-4858-BF6E-02A0F91E2FAA","cutSheetId":"D01FB5BA-A9E0-4B43-B4D4-568FED71A2BD","hasConfig":true,"configAccessories":"ZZOMEGASHIP1;ZZWARRANTY03;ZZOMEGAVLT02A01;ZZOMEGAVLT02A02A;","values":[{"property":"Motor HP","value":" 1 HP"},{"property":"Motor speed","value":"2-speed"},{"property":"Exterior Finish","value":"polycarbonate"},{"property":"Capacity","value":" 32 - 95 oz (1 - 2 qt)"},{"property":"Blender Type","value":"removable plastic container"}],"certifications":[{"text":"CE"},{"text":"ETL"}],"utils":{"electrical":[{"order":1,"amps":"","kw":".6","hp":"1","mca":"","mocp":"","voltage":"_","cycle":"_","nema":"","remarks":"","phase":"\*","electricalConnectionHeight":"","connectionType":""}]},"changeState":"added"}

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [September 19, 2017, 1:42am UTC](https://discuss.elastic.co/t/json-file-input/100916/4 "2017-09-19T01:42:39Z")

</div>

Please don't post pictures of text, they are difficult to read and some people may not be even able to see them.

---

<div class="post-metadata">

### Author: ![Pratiksha\_Tewary](https://avatars.discourse-cdn.com/v4/letter/p/a88e4f/32.png) [@Pratiksha\_Tewary](https://discuss.elastic.co/u/Pratiksha_Tewary)
#### Post date: [September 19, 2017, 3:21pm UTC](https://discuss.elastic.co/t/json-file-input/100916/5 "2017-09-19T15:21:10Z")

</div>

Sorry about that. I am new to discussion forums. Initially I was talking about Ubuntu Linux which I was running on my Virtual Machine (Virtualbox). Unfortunately, that has crashed. I have now installed Logstash on my original Windows environment. Following are the details of my trial:

**In Windows Powershell, I ran this command** :  
.\bin\logstash -f grok\_trial.conf

**I got the following output** :  
Sending Logstash's logs to C:/Users/prati/Desktop/ELK/logstash/logs which is now configured via log4j2.properties  
[2017-09-19T11:10:26,223][INFO][logstash.modules.scaffold] Initializing module {:module\_name=\>"fb\_apache", :directory=\>"C:/Users/prati/Desktop/ELK/logstash/modules/fb\_apache/configuration"}  
[2017-09-19T11:10:26,230][INFO][logstash.modules.scaffold] Initializing module {:module\_name=\>"netflow", :directory=\>"C:/Users/prati/Desktop/ELK/logstash/modules/netflow/configuration"}  
[2017-09-19T11:10:26,712][INFO][logstash.pipeline] Starting pipeline {"id"=\>"main", "pipeline.workers"=\>4, "pipeline.batch.size"=\>125, "pipeline.batch.delay"=\>5, "pipeline.max\_inflight"=\>500}  
[2017-09-19T11:10:27,046][INFO][logstash.pipeline] Pipeline main started  
[2017-09-19T11:10:27,177][INFO][logstash.agent] Successfully started Logstash API endpoint {:port=\>9600}

**The contents of grok\_trial.conf are** :  
input {  
file {  
path =\> ["C:\Users\prati\Desktop\CE\_Training\singlejson.json"]  
start\_position =\> "beginning"  
type =\> "json"  
}  
}  
output {  
stdout {  
codec =\> "rubydebug"  
}  
}

**The contents of the file singlejson.json are** :  
{"prodId":"00583BE8-BE33-E011-BF97-001018721196","vendorName":"Omega","vendorId":"212770E7-E633-E011-BF97-001018721196","model":"DishStarÂ®","categoryName":"Blender, Food, Countertop","fob":{"city":"Ft. Lauderdale","state":"FL","zip":"33331"},"spec":"Omega Blender, 48 oz. Tritan coopolyester BPA-Free container, toggle control with high/low speed, heavy duty locking ring, recessed coupling system, removable stainless steel blade assembly, silver, 1 HP, 600 watts, CE, ETL","listPrice":164.0,"netPrice":0.0,"numPerCase":1,"sellingUnit":"ea","shippingCube":0.0,"shippingWeight":7.0,"freightClass":"85","height":15.5,"width":8.0,"depth":7.0,"catalogItem":true,"multiplier":0,"hideModel":false,"callForPricing":false,"pictureId":"9B6AC60C-CF96-4858-BF6E-02A0F91E2FAA","cutSheetId":"D01FB5BA-A9E0-4B43-B4D4-568FED71A2BD","hasConfig":true,"configAccessories":"ZZOMEGASHIP1;ZZWARRANTY03;ZZOMEGAVLT02A01;ZZOMEGAVLT02A02A;","values":[{"property":"Motor HP","value":" 1 HP"},{"property":"Motor speed","value":"2-speed"},{"property":"Exterior Finish","value":"polycarbonate"},{"property":"Capacity","value":" 32 - 95 oz (1 - 2 qt)"},{"property":"Blender Type","value":"removable plastic container"}],"certifications":[{"text":"CE"},{"text":"ETL"}],"utils":{"electrical":[{"order":1,"amps":"","kw":".6","hp":"1","mca":"","mocp":"","voltage":"","cycle":"","nema":"","remarks":"","phase":"\*","electricalConnectionHeight":"","connectionType":""}]},"changeState":"added"}

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [September 20, 2017, 12:41am UTC](https://discuss.elastic.co/t/json-file-input/100916/6 "2017-09-20T00:41:24Z")

</div>

That all looks fine.  
If you have processed the file before then you are likely running into `sincedb` being aware of that and not processing the file, even with the `before` directive. You may need to set the `sincedb` path to `NUL` to process the file.

---

<div class="post-metadata">

### Author: ![Pratiksha\_Tewary](https://avatars.discourse-cdn.com/v4/letter/p/a88e4f/32.png) [@Pratiksha\_Tewary](https://discuss.elastic.co/u/Pratiksha_Tewary)
#### Post date: [September 29, 2017, 1:33pm UTC](https://discuss.elastic.co/t/json-file-input/100916/7 "2017-09-29T13:33:43Z")

</div>

Thanks, I fixed the problem by adding a sensible path for 'sincedb\_path' which logstash has permission to write to. Also, we need to make sure that the input file has an extra blank line at the end of the file. I don't know why this needs to be done (maybe Mark you can throw light on this) but it started working just fine when I did.

---

<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: [October 27, 2017, 1:33pm UTC](https://discuss.elastic.co/t/json-file-input/100916/8 "2017-10-27T13:33:53Z")

</div>

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