# 2 hit observed in kibana whreas I ingest only once using logstash

**URL:** https://discuss.elastic.co/t/2-hit-observed-in-kibana-whreas-i-ingest-only-once-using-logstash/255064
**Category:** Logstash
**Created:** [November 11, 2020, 1:02pm UTC](https://discuss.elastic.co/t/2-hit-observed-in-kibana-whreas-i-ingest-only-once-using-logstash/255064 "2020-11-11T13:02:40Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Sivajanani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sivajanani/32/75053_2.png) [@Sivajanani](https://discuss.elastic.co/u/Sivajanani)
#### Post date: [November 11, 2020, 1:02pm UTC](https://discuss.elastic.co/t/2-hit-observed-in-kibana-whreas-i-ingest-only-once-using-logstash/255064/1 "2020-11-11T13:02:41Z")

</div>

I have my logstash config file as below,

```auto
input{
	file {
		type => "json"
		path => "D:/a-json.json"
		start_position => "beginning"
		sincedb_path => "NUL"
		mode => "read"
		file_completed_action => "log"
		file_completed_log_path => "nul"
		codec => json
 }
 }
 filter {
	json {
		source => "message"
 }
	split{
		field => "group"
 }
	if [group][type] == "Adversary" {
		mutate{
			add_field => {
				"group_name" => "%{[group][name]}"	
				"tags" => ""
				"summary" => ""
			}
		}
		ruby {
			code => '
				a = event.get("[group][tag]")
				if a
					s = ""
					a.each_index { |x|
						s += a[x]["name"]+","
					}
				
            event.set("[@metadata][tags]", s)
			event.set("tags", s.split(","))
			end
			'
		}
		ruby {
			code => '
				c = event.get("[indicator]")
				if c
					b = ""
					c.each_index { |x|
						b += c[x]["summary"]+","
					}
				
            event.set("[summary]",b)
			event.set("summary", b.split(","))
			end
			'
		}
		
	}
			
	prune {
 		whitelist_names => ["group_name","tags","summary"]
		}
	fingerprint {
			method => "SHA256"
			source => ["group_name"]
			target => "[@metadata][generate_id]"
		}	
 }
 output { 
	elasticsearch {
	hosts => ["https://local:9200"]
	user => " ******"
	password => " *****"
	index => "testing"
	document_id => "%{[@metadata][generate_id]}"	
	}
	stdout { 
		codec => rubydebug
	} 
}

```

If I am trying to ingest it one time using logstash, I am getting 2 hit in kibana with the following details,  
1st hit:\_id,type,\_index,\_score  
2nd hit:\_id,type,\_index,\_score,summary,tags,group\_name

How to remove the first hit and have one hit alone with all the details?

---

<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: [December 9, 2020, 1:02pm UTC](https://discuss.elastic.co/t/2-hit-observed-in-kibana-whreas-i-ingest-only-once-using-logstash/255064/2 "2020-12-09T13:02:42Z")

</div>

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