Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regex processor ignores namepass filter #5327

Closed
sgtsquiggs opened this issue Jan 22, 2019 · 2 comments
Closed

Regex processor ignores namepass filter #5327

sgtsquiggs opened this issue Jan 22, 2019 · 2 comments

Comments

@sgtsquiggs
Copy link
Contributor

Relevant telegraf.conf:

[[inputs.tail]]
  files = ["test.log"]
  from_beginning = false
  data_format = "influx"
[[processors.regex]]
  namepass = "notalert"
  [[processors.regex.tags]]
    key = "source"
    pattern = "^.*/.*/([\\d]+)$"
    replacement = "${1}"
    result_key = "instance"

System info:

RHEL Linux 4.4.75-el6.x86_64.lime.1
Telegraf 1.9.2

Steps to reproduce:

Using log data generator:

#!/bin/bash

rm -f test.log
while [ 1 ]
do
	num=$(( ( RANDOM % 100 )  + 1 ))
	echo 'alert,host=localhost,severity=INFO,source=blah/test/'$num',type=1 data="blah blah blah" '$(date +%s%N) >> test.log
	sleep 1
done

use telegraf config above

Expected behavior:

lines from inputs.tail with metric name alert should not have the instance tag added by the processor regex which has namepass=notalert

Actual behavior:

all output entries have instance tag regardless of metric name

Additional info:

test.log:

alert,host=localhost,severity=INFO,source=blah/test/94,type=1 data="blah blah blah" 1548182801985227789
alert,host=localhost,severity=INFO,source=blah/test/31,type=1 data="blah blah blah" 1548182802987834242
alert,host=localhost,severity=INFO,source=blah/test/97,type=1 data="blah blah blah" 1548182803989886698
alert,host=localhost,severity=INFO,source=blah/test/78,type=1 data="blah blah blah" 1548182804991547174

telegraf stdout:

2019-01-22T18:46:49Z I! Starting Telegraf 1.9.2
2019-01-22T18:46:49Z I! Loaded inputs: inputs.tail
2019-01-22T18:46:49Z I! Loaded aggregators: 
2019-01-22T18:46:49Z I! Loaded processors: regex
2019-01-22T18:46:49Z I! Loaded outputs: file
2019-01-22T18:46:49Z I! Tags enabled: host=localhost
2019-01-22T18:46:49Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"localhost", Flush Interval:600ms
alert,host=localhost,instance=94,path=test.log,severity=INFO,source=blah/test/94,type=1 data="blah blah blah" 1548182801985227789
alert,host=localhost,instance=31,path=test.log,severity=INFO,source=blah/test/31,type=1 data="blah blah blah" 1548182802987834242
alert,host=localhost,instance=97,path=test.log,severity=INFO,source=blah/test/97,type=1 data="blah blah blah" 1548182803989886698
alert,host=localhost,instance=78,path=test.log,severity=INFO,source=blah/test/78,type=1 data="blah blah blah" 1548182804991547174
@sgtsquiggs
Copy link
Contributor Author

Nevermind. After debugging it looks like nampass expects an array.

@danielnelson
Copy link
Contributor

Sorry about this, I think the lack of error is related to #3444

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants