# Multiple IIS logs - Add field (?)

**URL:** <https://discuss.elastic.co/t/multiple-iis-logs-add-field/181319>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [May 16, 2019, 6:44am UTC](https://discuss.elastic.co/t/multiple-iis-logs-add-field/181319 "2019-05-16T06:44:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shortcommand](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@shortcommand](https://discuss.elastic.co/u/shortcommand)\
**Post date:** [May 16, 2019, 6:44am UTC](https://discuss.elastic.co/t/multiple-iis-logs-add-field/181319/1 "2019-05-16T06:44:46Z")

</div>

Hi, I don't know if this goes into filebeat category, logstash or both.

I've around 50 websites on a single server. Running one instance of filebeat with IIS module enabled. My problem is that In Kibana I would like to be able to search for SiteX and show all logs/events from said site. Ideally this would be done with adding a field containing the site name.

What would be the best way of achieving this? I'm outputting filebeat to logstash where I've a grok filter matching default IIS logs.

My iis module config looks like the following:

> -module: iis  
> #Access logs  
> access:  
> enabled: true  
> # Set custom paths for the log files. If left empty,  
> # Filebeat will choose the paths depending on your OS.  
> var.paths: ["F:/site1/_.log"]  
> var.paths: ["F:/site2/_.log"]  
> etc.

Logstash config:

> input {  
> beats {  
> port =\> 5044  
> }  
> }  
> filter {  
> grok {  
> match =\> ["message", "%{TIMESTAMP\_ISO8601:log\_timestamp} %{IP:serverIP} %{WORD:method} %{URIPATH:uriStem} %{NOTSPACE:uriQuery} %{NUMBER:port} %{NOTSPACE:username} %{IPORHOST:clientIP} %{NOTSPACE:userAgent} %{NOTSPACE:referer} %{NUMBER:response} %{NUMBER:subresponse} %{NUMBER:win32response} %{NUMBER:timetaken}"]  
> }

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![shortcommand](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@shortcommand](https://discuss.elastic.co/u/shortcommand)\
**Post date:** [May 17, 2019, 9:32am UTC](https://discuss.elastic.co/t/multiple-iis-logs-add-field/181319/2 "2019-05-17T09:32:37Z")

</div>

I managed to add a custom field to the filebeat output, but the field is added for all logs.  
There is a metadata field called log.file.path, is there a way to match metadata field and add a field based on the value in log.file.path?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![pierhugues](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pierhugues/32/48383_2.png) [@pierhugues](https://discuss.elastic.co/u/pierhugues)\
**Post date:** [May 23, 2019, 1:00am UTC](https://discuss.elastic.co/t/multiple-iis-logs-add-field/181319/3 "2019-05-23T01:00:05Z")

</div>

Hello,

You could use grok on the `file.path` on the event and extract the name of the site and it to a custom field? I am assuming it's possible because each path is unique and maybe reflect the name of the site.

```auto
var.paths: ["F:/site1/.log"]
var.paths: ["F:/site2/.log"]

```

---

<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 20, 2019, 1:00am UTC](https://discuss.elastic.co/t/multiple-iis-logs-add-field/181319/4 "2019-06-20T01:00:12Z")

</div>

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