# Logstash config file error

**URL:** <https://discuss.elastic.co/t/logstash-config-file-error/96878>\
**Category:** Logstash\
**Created:** [August 13, 2017, 2:23pm UTC](https://discuss.elastic.co/t/logstash-config-file-error/96878 "2017-08-13T14:23:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![varun1992](https://avatars.discourse-cdn.com/v4/letter/v/3da27b/32.png) [@varun1992](https://discuss.elastic.co/u/varun1992)\
**Post date:** [August 13, 2017, 2:23pm UTC](https://discuss.elastic.co/t/logstash-config-file-error/96878/1 "2017-08-13T14:23:13Z")

</div>

I got an error like below when indexing in logstash

![image](https://us1.discourse-cdn.com/elastic/original/3X/7/9/79f27511e54b896f2d8290d6ad9b0692c2e2b518.png)

Log file model is

date=2017-01-24 time=07:24:24 logid=0000000013 type=traffic subtype=forward level=notice vd=root srcip=192.168.1.110 srcport=60846 srcintf="internal" dstip=72.21.91.29 dstport=80 dstintf="wan1" poluuid=b7f14824-e247-51e6-fc2c-b25329293b13 sessionid=1226 proto=6 action=close policyid=1 policytype=policy dstcountry="United States" srccountry="Reserved" trandisp=snat transip=192.168.254.50 transport=60846 service="HTTP" duration=20 sentbyte=186 rcvdbyte=146 sentpkt=4 rcvdpkt=3 appcat="unscanned"

Config file as below

input {  
file {  
type =\> "fortynet"  
path =\> "C:/ElasticProducts/FortiNet.log"  
start\_position =\> "beginning"  
sincedb\_path =\> "/dev/null"  
}  
}

grok {  
match =\> ["message", "date=%{YEAR:year}-%{MONTHNUM:month}-%{MONTHDAY:day} time=%{TIME:time} logid=%{NUMBER:logid} type=%{WORD:type} subtype=%{WORD:subtype} level=%{WORD:level} vd=%{WORD:vd} srcip=%{IP:src-ip} srcport=%{NUMBER:src-port} srcintf=%{QUOTEDSTRING:src-intf} dstip=%{IP:dst-ip} dstport=%{NUMBER:dst-port} dstintf=%{QUOTEDSTRING:dst-intf} poluuid=%{NOTSPACE:poluuid} sessionid=%{NUMBER:sessionid} proto=%{NUMBER:proto} action=%{WORD:action} policyid=%{NUMBER:policyid} policytype=%{WORD:policytype} dstcountry=%{QUOTEDSTRING:dst-country} srccountry=%{QUOTEDSTRING:src-country} trandisp=%{WORD:trandisp} transip=%{IP:trans-ip} transport=%{NUMBER:trans-port} service=%{QUOTEDSTRING:service} duration=%{NUMBER:duration} sentbyte=%{NUMBER:sentbyte} rcvdbyte=%{NUMBER:rcvdbyte} sentpkt=%{NUMBER:sentpkt} rcvdpkt=%{NUMBER:rcvdpkt} appcat=%{QUOTEDSTRING:appcat}"]  
}

mutate {  
add\_field =\> {  
"timestamp" =\> "%{year}-%{month}-%{day} %{time}"  
}  
}  
date {  
match =\> ["timestamp" , "yyyy-MM-dd HH:mm:ss"]  
timezone =\> "Etc/UTC"  
}

output {  
elasticsearch {  
hosts =\> ["localhost:9200"]  
user =\> "elastic"  
password =\> "changeme"  
index =\> "fortynet"  
#template =\> "C:\ElasticProducts\fortynet.json"  
document\_id =\> "%{logid}"  
document\_type =\> "fortynet"  
template\_overwrite =\> true  
}

stdout {  
debug =\> true debug\_format =\> "json"  
codec =\> rubydebug  
}  
}

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [August 13, 2017, 6:33pm UTC](https://discuss.elastic.co/t/logstash-config-file-error/96878/2 "2017-08-13T18:33:16Z")

</div>

You need to wrap your filters (grok, mutate, and date) in a `filter { ... }` block.

Unrelated to that you should look into using a kv filter to parse the key/value pairs in your message.

---

<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:** [September 10, 2017, 6:33pm UTC](https://discuss.elastic.co/t/logstash-config-file-error/96878/3 "2017-09-10T18:33:23Z")

</div>

Closed on September 10, 2017, 6:33pm UTC

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