# How to ingest different set of logs into single index

**URL:** <https://discuss.elastic.co/t/how-to-ingest-different-set-of-logs-into-single-index/144702>\
**Category:** Logstash\
**Created:** [August 16, 2018, 11:15am UTC](https://discuss.elastic.co/t/how-to-ingest-different-set-of-logs-into-single-index/144702 "2018-08-16T11:15:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nithani25](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nithani25/32/33457_2.png) [@Nithani25](https://discuss.elastic.co/u/Nithani25)\
**Post date:** [August 16, 2018, 11:15am UTC](https://discuss.elastic.co/t/how-to-ingest-different-set-of-logs-into-single-index/144702/1 "2018-08-16T11:15:26Z")

</div>

Hi Team,  
I am working on a project, where i have multiple set of log files(apache,syslogs & java logs) coming from different set of sources, i was successful in creating separate set of indices and combined one's where both the inputs comes from same server(using fields) section, Now i am in need to create one single index for all these log files.

Can i achieve this by assigning a logtype input along with filei nput coming from beat port in input filter and by using if conditional in filter section!!!  
Is this a good Idea!!

---

<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 16, 2018, 6:18pm UTC](https://discuss.elastic.co/t/how-to-ingest-different-set-of-logs-into-single-index/144702/2 "2018-08-16T18:18:50Z")

</div>

Yes, it sounds reasonable.

---

<div class="post-metadata">

**Author:** ![Nithani25](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nithani25/32/33457_2.png) [@Nithani25](https://discuss.elastic.co/u/Nithani25)\
**Post date:** [August 20, 2018, 9:51am UTC](https://discuss.elastic.co/t/how-to-ingest-different-set-of-logs-into-single-index/144702/3 "2018-08-20T09:51:12Z")

</div>

I have a question here, the apache combined logs index has both apache error and access logs in them coming from two different files in the same server, so when i parse them through filebeat , they are sent to specific port while the syslogs comes from different source(different server and different port) , how can i include all of them in logstash conf...

```
input {
  beats {
    port => "5070"
	input_type => combinedapache
        }
	beats {
    port => "5071"
	input_type => syslog
        }
}

```

How will i be able to represent them in filter section(since the combined apache has two sets of log in them).

---

<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 20, 2018, 12:36pm UTC](https://discuss.elastic.co/t/how-to-ingest-different-set-of-logs-into-single-index/144702/4 "2018-08-20T12:36:09Z")

</div>

You can e.g. use a grok filter that attempts to parse the event as an access log entry. If that's successful, add a field or tag to mark it as an access log. If the parsing fails the event will get the `_grokparsefailure` tag and you can attempt another grok filter.

(You can list multiple grok expressions in the same filter but then you can't set a tag or field value to indicate which expression matched.)

---

<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 17, 2018, 12:36pm UTC](https://discuss.elastic.co/t/how-to-ingest-different-set-of-logs-into-single-index/144702/5 "2018-09-17T12:36:19Z")

</div>

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