# Merging information from two log files

**URL:** https://discuss.elastic.co/t/merging-information-from-two-log-files/28914
**Category:** Logstash
**Created:** [September 9, 2015, 8:51am UTC](https://discuss.elastic.co/t/merging-information-from-two-log-files/28914 "2015-09-09T08:51:31Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Navneet\_Mathpal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/navneet_mathpal/32/3677_2.png) [@Navneet\_Mathpal](https://discuss.elastic.co/u/Navneet_Mathpal)
#### Post date: [September 9, 2015, 8:51am UTC](https://discuss.elastic.co/t/merging-information-from-two-log-files/28914/1 "2015-09-09T08:51:31Z")

</div>

Hi ,

I need to merge the information from two log file  
ex: From the first log file I am getting some log information and second log file I am getting ID , I want to append that ID with each logs coming from first file..

I am doing it like

> > input  
> > {  
> > file  
> > {  
> > path =\> "D:/log\_file/insightlogfolder/\*"  
> > sincedb\_path =\> "D:/data1.sincedb"  
> > type =\> "logfile"  
> > start\_position =\> "beginning"  
> > }

```
	file 
	{
		path => "D:/log_file/ID/*"
		type => "pidlog"
		sincedb_path => "D:/data2.sincedb"
		start_position => "beginning"
	}	
}
filter       
{
	grok 
	{
		match => ["message", "%{NUMBER:id}"]

	}
	if [type] == "logfile"
	{
		grok 
		{
			patterns_dir => "D:/log_file/patterns"
			match => ["message", "%{MASTER_LOG}"]
			add_field => { "errorlog" => "errorlog" }
		}
	}
	mutate 
	{
			add_field => { "ID" => "%{id}" }
	}

}

```

But not getting the desired result,  
please anyone can help

---

<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: [September 9, 2015, 9:06am UTC](https://discuss.elastic.co/t/merging-information-from-two-log-files/28914/2 "2015-09-09T09:06:27Z")

</div>

Logstash doesn't support that kind of log merging. Not with the stock plugins anyway. It would certainly be possible to write a custom plugin for it.

---

<div class="post-metadata">

### Author: ![Navneet\_Mathpal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/navneet_mathpal/32/3677_2.png) [@Navneet\_Mathpal](https://discuss.elastic.co/u/Navneet_Mathpal)
#### Post date: [September 16, 2015, 3:32pm UTC](https://discuss.elastic.co/t/merging-information-from-two-log-files/28914/3 "2015-09-16T15:32:58Z")

</div>

@magnusbaeck I was going through some posts , I came accross plugin "logstash-filter-memorize" , can it be done through this ?

---

<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: [September 16, 2015, 5:45pm UTC](https://discuss.elastic.co/t/merging-information-from-two-log-files/28914/4 "2015-09-16T17:45:46Z")

</div>

Possibly, yes, but I'd be worried about corner cases. It definitely looks like it would work if both records that you want to merge come from the same file so that their internal order is fixed. But if they come from different files, how can you be sure that the records are read in the order required?

---

<div class="post-metadata">

### Author: ![Pratheek](https://avatars.discourse-cdn.com/v4/letter/p/a698b9/32.png) [@Pratheek](https://discuss.elastic.co/u/Pratheek)
#### Post date: [May 29, 2017, 11:34am UTC](https://discuss.elastic.co/t/merging-information-from-two-log-files/28914/5 "2017-05-29T11:34:35Z")

</div>

Hi,

Is there any update on this thread ? Will it be possible by any chance to get information from two log files merged?

---

<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: [July 6, 2017, 4:26am UTC](https://discuss.elastic.co/t/merging-information-from-two-log-files/28914/6 "2017-07-06T04:26:17Z")

</div>


