# Can we add fields value based on regex patterns in include\_lines for the same log

**URL:** <https://discuss.elastic.co/t/can-we-add-fields-value-based-on-regex-patterns-in-include-lines-for-the-same-log/156604>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [November 14, 2018, 8:49am UTC](https://discuss.elastic.co/t/can-we-add-fields-value-based-on-regex-patterns-in-include-lines-for-the-same-log/156604 "2018-11-14T08:49:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![krishanagrawal](https://avatars.discourse-cdn.com/v4/letter/k/22d042/32.png) [@krishanagrawal](https://discuss.elastic.co/u/krishanagrawal)\
**Post date:** [November 14, 2018, 8:49am UTC](https://discuss.elastic.co/t/can-we-add-fields-value-based-on-regex-patterns-in-include-lines-for-the-same-log/156604/1 "2018-11-14T08:49:38Z")

</div>

I am parsing a log file which has error from 3 different process.  
I have added the input file in path and have added the 3 regex pattern in include line unique to 3 processes.  
Can I add field column which will be populated with the log line based on the regex pattern it matched in include\_lines tag?

eg:

logs are:  
[p1\_err] adc....  
[p2\_err] adc....  
[p3\_warn] adc....  
[p1\_warn] adc....  
[p3\_err] adc....  
....

in my filebeat.yml

filebeat.inputs:

- type: log  
paths:
  - \<log\_file\>  
include\_lines: ['p1\_err', 'p2\_err', 'p3\_err']

I want to see the count of p1\_err,p2\_err,p3\_err lines in output on kibana.

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [November 14, 2018, 3:41pm UTC](https://discuss.elastic.co/t/can-we-add-fields-value-based-on-regex-patterns-in-include-lines-for-the-same-log/156604/2 "2018-11-14T15:41:06Z")

</div>

`include_lines` is just for prefiltering, it's no parser.

You can either go schemaless and use filtering on the "message" field in kibana UI in order to count events matching a pattern or use grok (Logstash or Ingest Node), or dissect (Filebeat or Logstash or Ingest Node) to do some minimal parsing. E.g. see [Filebeat dissect docs](https://www.elastic.co/guide/en/beats/filebeat/current/dissect.html).

---

<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 12, 2018, 3:47pm UTC](https://discuss.elastic.co/t/can-we-add-fields-value-based-on-regex-patterns-in-include-lines-for-the-same-log/156604/3 "2018-12-12T15:47:41Z")

</div>

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