Reputation: 117
i need to capture two different components from tail into two different tag. currently i am using the below code to capture one of the pattern. Please help on how two accommodate two regex
<source>
@type tail
<parse>
@type regexp
expression /^(.*) Request(.*) CODE=(?<code>[0-9][0-9]?[0-9]?[0-9]?[0-9]?)(.*)$/
</parse>
tag req
path /logs/MG_60100*.log.*
pos_file /var/run/fluentd/access.log.pos
</source>
my other regex is
<parse>
@type regexp
expression /^(.*)Response: 200(.*)$/
</parse>
how and where to place this?? Please help
Upvotes: 0
Views: 1436
Reputation: 117
defined two sources as below with different pos file. Worked for me
<source>
@type tail
<parse>
@type regexp
expression /^(.*) Request(.*) CODE=(?<code>[0-9][0-9]?[0-9]?[0-9]?[0-9]?)(.*)$/
</parse>
tag req
path /logs/*.log.*
pos_file /var/run/fluentd/access.log.pos
</source>
<source>
@type tail
<parse>
@type regexp
expression /^(.*)Response: 201.*)$/
</parse>
path /logs/*.log.*
pos_file /var/run/fluentd/access1.log.pos
tag req1
</source>
Upvotes: 1