# Getting Data duplicated while parsing the logs using Logstash

**URL:** <https://discuss.elastic.co/t/getting-data-duplicated-while-parsing-the-logs-using-logstash/86138>\
**Category:** Logstash\
**Created:** [May 17, 2017, 3:39pm UTC](https://discuss.elastic.co/t/getting-data-duplicated-while-parsing-the-logs-using-logstash/86138 "2017-05-17T15:39:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajat\_Singh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajat_singh/32/48128_2.png) [@Rajat\_Singh](https://discuss.elastic.co/u/Rajat_Singh)\
**Post date:** [May 17, 2017, 3:39pm UTC](https://discuss.elastic.co/t/getting-data-duplicated-while-parsing-the-logs-using-logstash/86138/1 "2017-05-17T15:39:35Z")

</div>

Hello Folks,

I am using Logstash for the purpose of parsing the logs to elasticsearch as their were 4 files each of 4 gb ,It took around one day it to parse all the value.  
so my first concern is that what things in can do to improve the parsing speed  
second concern is that i don't know how the data from one of the file got duplicated.

---

<div class="post-metadata">

**Author:** ![jsvd](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsvd/32/6203_2.png) [@jsvd](https://discuss.elastic.co/u/jsvd)\
**Post date:** [May 19, 2017, 9:42am UTC](https://discuss.elastic.co/t/getting-data-duplicated-while-parsing-the-logs-using-logstash/86138/2 "2017-05-19T09:42:19Z")

</div>

can you show the configuration you used?

---

<div class="post-metadata">

**Author:** ![Rajat\_Singh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajat_singh/32/48128_2.png) [@Rajat\_Singh](https://discuss.elastic.co/u/Rajat_Singh)\
**Post date:** [May 21, 2017, 4:57pm UTC](https://discuss.elastic.co/t/getting-data-duplicated-while-parsing-the-logs-using-logstash/86138/3 "2017-05-21T16:57:45Z")

</div>

input  
{  
file {  
path =\> ["/root/logstash/logstash-2.4.0/bin/Logs/one/disp1.log"]  
start\_position =\> "beginning"  
type =\> "Disp1"  
}

file  
{  
path =\> ["/root/logstash/logstash-2.4.0/bin/Logs/two/disp2.log"]  
start\_position =\> "beginning"  
type =\> "Disp2"   
}

file  
{  
path =\> ["/root/logstash/logstash-2.4.0/bin/Logs/three/disp3.log"]  
start\_position =\> "beginning"  
type =\> "Disp3"   
}

file  
{  
path =\> ["/root/logstash/logstash-2.4.0/bin/Logs/four/disp4.log"]  
start\_position =\> "beginning"  
type =\> "Disp4"   
}

}   
filter  
{  
if [type] == "Disp1" {  
if "health" in [message] { drop{} }

```
  else
  {

```

grok {  
match =\> { message =\> [  
"%{IPV4:ip} - - (?[%{MONTHDAY:day}/%{MONTH:month}/%{YEAR:year}:%{TIME:time} -%{INT:seconds}]) "%{WORD:method} %{NOTSPACE:url} %{NOTSPACE:protocol}" %{INT:http\_code} %{INT:download\_byte} "%{DATA:refer}" "%{DATA:user\_agent}" "%{NOTSPACE:transaction\_name}" %{INT:response\_time\_sec} %{INT:response\_time}"

```
                  ]}
				  
				  
		add_tag => ["Disp1"]

```

}

mutate {  
convert =\> { "http\_code" =\> "integer"}  
convert =\> { "download\_byte" =\> "integer"}  
convert =\> { "response\_time\_sec" =\> "integer"}  
convert =\> { "response\_time" =\> "integer"}  
}

```
							ruby {

```

code =\> "event.set('response\_time\_sec', event.get('response\_time\_sec').to\_f / 1000000)"  
}

```
			}

```

}

if [type] == "Disp2" {  
if "health" in [message] { drop{} }

```
  else
  {

```

grok {  
match =\> { message =\> [  
"%{IPV4:ip} - - (?[%{MONTHDAY:day}/%{MONTH:month}/%{YEAR:year}:%{TIME:time} -%{INT:seconds}]) "%{WORD:method} %{NOTSPACE:url} %{NOTSPACE:protocol}" %{INT:http\_code} %{INT:download\_byte} "%{DATA:refer}" "%{DATA:user\_agent}" "%{NOTSPACE:transaction\_name}" %{INT:response\_time\_sec} %{INT:response\_time}"

```
                  ]}
				  
				  
		add_tag => ["Disp2"]

```

}

mutate {  
convert =\> { "http\_code" =\> "integer"}  
convert =\> { "download\_byte" =\> "integer"}  
convert =\> { "response\_time\_sec" =\> "integer"}  
convert =\> { "response\_time" =\> "integer"}  
}  
ruby {  
code =\> "event.set('response\_time\_sec', event.get('response\_time\_sec').to\_f / 1000000)"  
}

```
			}

```

}

if [type] == "Disp3" {  
if "health" in [message] { drop{} }

```
  else
  {

```

grok {  
match =\> { message =\> [  
"%{IPV4:ip} - - (?[%{MONTHDAY:day}/%{MONTH:month}/%{YEAR:year}:%{TIME:time} -%{INT:seconds}]) "%{WORD:method} %{NOTSPACE:url} %{NOTSPACE:protocol}" %{INT:http\_code} %{INT:download\_byte} "%{DATA:refer}" "%{DATA:user\_agent}" "%{NOTSPACE:transaction\_name}" %{INT:response\_time\_sec} %{INT:response\_time}"

```
                  ]}
				  
				  
		add_tag => ["Disp3"]

```

}

mutate {  
convert =\> { "http\_code" =\> "integer"}  
convert =\> { "download\_byte" =\> "integer"}  
convert =\> { "response\_time\_sec" =\> "integer"}  
convert =\> { "response\_time" =\> "integer"}  
}  
ruby {  
code =\> "event.set('response\_time\_sec', event.get('response\_time\_sec').to\_f / 1000000)"  
}

```
			}

```

}

if [type] == "Disp4" {  
if "health" in [message] { drop{} }

```
  else
  {

```

grok {  
match =\> { message =\> [  
"%{IPV4:ip} - - (?[%{MONTHDAY:day}/%{MONTH:month}/%{YEAR:year}:%{TIME:time} -%{INT:seconds}]) "%{WORD:method} %{NOTSPACE:url} %{NOTSPACE:protocol}" %{INT:http\_code} %{INT:download\_byte} "%{DATA:refer}" "%{DATA:user\_agent}" "%{NOTSPACE:transaction\_name}" %{INT:response\_time\_sec} %{INT:response\_time}"

```
                  ]}
				  
				  add_tag => ["Disp4"]

```

}

mutate {  
convert =\> { "http\_code" =\> "integer"}  
convert =\> { "download\_byte" =\> "integer"}  
convert =\> { "response\_time\_sec" =\> "integer"}  
convert =\> { "response\_time" =\> "integer"}  
}  
ruby {  
code =\> "event.set('response\_time\_sec', event.get('response\_time\_sec').to\_f / 1000000)"  
}  
}  
}

}

output  
{  
stdout {codec =\> rubydebug}

if "Disp1" in [tags] {  
elasticsearch { hosts =\> ["100.150.86.175:9200"] index =\> "logstash-altria-test"}}

if "Disp2" in [tags] {  
elasticsearch { hosts =\> ["100.150.86.175:9200"] index =\> "logstash-altria-test"}}

if "Disp3" in [tags] {  
elasticsearch { hosts =\> ["100.150.86.175:9200"] index =\> "logstash-altria-test"}}

if "Disp4" in [tags]{  
elasticsearch { hosts =\> ["100.150.86.175:9200"] index =\> "logstash-altria-test"}}  
}

---

<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:** [June 18, 2017, 5:10pm UTC](https://discuss.elastic.co/t/getting-data-duplicated-while-parsing-the-logs-using-logstash/86138/4 "2017-06-18T17:10:45Z")

</div>

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