Skip to content

Commit b7f3e5b

Browse files
committed
Update example, and missed field -> source change
1 parent 761b35e commit b7f3e5b

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

example.conf

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,40 @@
11
input {
2+
3+
# This works
24
generator {
3-
message => "google.com"
5+
message => "www.google.com"
46
count => 1
7+
type => "test1"
58
}
69

10+
# This will fail
711
generator {
8-
message => "google.co.uk"
12+
message => "google.co.ukf"
913
count => 1
14+
type => "test1"
1015
}
16+
17+
# Shows using the source option
18+
generator {
19+
message => "The domain is www.google.com"
20+
count => 1
21+
type => "test2"
22+
}
23+
1124
}
1225

1326
filter {
14-
tld {}
27+
if [type] == "test1" {
28+
tld {}
29+
}
30+
if [type] == "test2" {
31+
grok {
32+
match => [ "message", "The domain is %{HOST:domain}" ]
33+
}
34+
tld {
35+
source => "domain"
36+
}
37+
}
1538
}
1639

1740
output {

lib/logstash/filters/tld.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def register
3535
public
3636
def filter(event)
3737

38-
if @field and PublicSuffix.valid?(event[@source])
38+
if @source and PublicSuffix.valid?(event[@source])
3939
domain = PublicSuffix.parse(event[@source])
4040
# Replace the event message with our message as configured in the
4141
# config file.

0 commit comments

Comments
 (0)