fluent-plugin-filter-geoip 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fluent-plugin-filter-geoip.gemspec +1 -1
- data/lib/fluent/plugin/filter_geoip.rb +22 -64
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 281246f8362ef2bdfa0d4d0762793bdfbb1f9648
|
4
|
+
data.tar.gz: 26a1e254ee1ef72492edd4a11719fa677abb5643
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b66500baba501a96af1fd5c8eb4058464b723d96df3149da20535cc4677c456657b47f60daee8257d8c7ea742cc0f60a84194a6a5c55e4e65210c5b185bc74b
|
7
|
+
data.tar.gz: 44274bc2cbb807e46b32ebcafe4fdcc059a0f3addd7bb64ebcff9c99193c6c96a405295811e37293938437c27c160ba93037f1722dfb6315b25ee839651fa98b
|
@@ -32,64 +32,64 @@ module Fluent
|
|
32
32
|
DEFAULT_CONNECTION_TYPE = true
|
33
33
|
|
34
34
|
config_param :enable_auto_download, :string, :default => DEFAULT_ENABLE_DOWNLOAD,
|
35
|
-
:desc => ''
|
36
|
-
|
37
|
-
config_param :md5_path, :string, :default => DEFAULT_MD5_PATH,
|
38
|
-
:desc => ''
|
35
|
+
:desc => 'If true, enable to download GeoIP2 database autometically (default: %s).' % DEFAULT_ENABLE_DOWNLOAD
|
39
36
|
|
40
37
|
config_param :md5_url, :string, :default => DEFAULT_MD5_URL,
|
41
|
-
:desc => ''
|
38
|
+
:desc => 'GeoIP2 MD5 checksum URL (default: %s)' % DEFAULT_MD5_URL
|
42
39
|
|
43
40
|
config_param :download_url, :string, :default => DEFAULT_DOWNLOAD_URL,
|
44
|
-
:desc => ''
|
41
|
+
:desc => 'GeoIP2 database download URL (default: %s).' % DEFAULT_DOWNLOAD_URL
|
42
|
+
|
43
|
+
config_param :md5_path, :string, :default => DEFAULT_MD5_PATH,
|
44
|
+
:desc => 'GeoIP2 MD5 checksum path. (default: %s)' % DEFAULT_MD5_PATH
|
45
45
|
|
46
46
|
config_param :database_path, :string, :default => DEFAULT_DATABASE_PATH,
|
47
|
-
:desc => ''
|
47
|
+
:desc => 'GeoIP2 database path. (default: %s)' % DEFAULT_DATABASE_PATH
|
48
48
|
|
49
49
|
config_param :lookup_field, :string, :default => DEFAULT_LOOKUP_FIELD,
|
50
|
-
:desc => ''
|
50
|
+
:desc => 'Specify the field name that IP address is stored (default: %s).' % DEFAULT_LOOKUP_FIELD
|
51
51
|
|
52
52
|
config_param :output_field, :string, :default => DEFAULT_OUTPU_FIELD,
|
53
|
-
:desc => ''
|
53
|
+
:desc => 'Specify the field name that store the result (default: %s).' % DEFAULT_OUTPU_FIELD
|
54
54
|
|
55
55
|
config_param :field_delimiter, :string, :default => DEFAULT_FIELD_DELIMITER,
|
56
|
-
:desc => ''
|
56
|
+
:desc => 'Specify the field delimiter (default %s).' % DEFAULT_FIELD_DELIMITER
|
57
57
|
|
58
58
|
config_param :flatten, :bool, :default => DEFAULT_FLATTEN,
|
59
|
-
:desc => ''
|
59
|
+
:desc => 'If true, to flatten the result using field_delimiter (default: %s).' % DEFAULT_FLATTEN
|
60
60
|
|
61
61
|
config_param :locale, :string, :default => DEFAULT_LOCALE,
|
62
|
-
:desc => ''
|
62
|
+
:desc => 'Get the data for the specified locale (default: %s).' % DEFAULT_LOCALE
|
63
63
|
|
64
64
|
config_param :continent, :bool, :default => DEFAULT_CONTINENT,
|
65
|
-
:desc => ''
|
65
|
+
:desc => 'If true, to get continent information (default: %s).' % DEFAULT_CONTINENT
|
66
66
|
|
67
67
|
config_param :country, :bool, :default => DEFAULT_COUNTRY,
|
68
|
-
:desc => ''
|
68
|
+
:desc => 'If true, to get country information (default: %s).' % DEFAULT_COUNTRY
|
69
69
|
|
70
70
|
config_param :city, :bool, :default => DEFAULT_CITY,
|
71
|
-
:desc => ''
|
71
|
+
:desc => 'If true, to get city information (default: %s).' % DEFAULT_CITY
|
72
72
|
|
73
73
|
config_param :location, :bool, :default => DEFAULT_LOCATION,
|
74
|
-
:desc => ''
|
74
|
+
:desc => 'If true, to get location information (default: %s).' % DEFAULT_LOCATION
|
75
75
|
|
76
76
|
config_param :postal, :bool, :default => DEFAULT_POSTAL,
|
77
|
-
:desc => ''
|
77
|
+
:desc => 'If true, to get postal information (default: %s).' % DEFAULT_POSTAL
|
78
78
|
|
79
79
|
config_param :registered_country, :bool, :default => DEFAULT_REGISTERED_COUNTRY,
|
80
|
-
:desc => ''
|
80
|
+
:desc => 'If true, to get registered country information (default: %s).' % DEFAULT_REGISTERED_COUNTRY
|
81
81
|
|
82
82
|
config_param :represented_country, :bool, :default => DEFAULT_REPRESENTED_COUNTRY,
|
83
|
-
:desc => ''
|
83
|
+
:desc => 'If true, to get represented country information (default: %s).' % DEFAULT_REPRESENTED_COUNTRY
|
84
84
|
|
85
85
|
config_param :subdivisions, :bool, :default => DEFAULT_SUBDIVISIONS,
|
86
|
-
:desc => ''
|
86
|
+
:desc => 'If true, to get subdivisions information (default: %s).' % DEFAULT_SUBDIVISIONS
|
87
87
|
|
88
88
|
config_param :traits, :bool, :default => DEFAULT_TRAITS,
|
89
|
-
:desc => ''
|
89
|
+
:desc => 'If true, to get traits information (default: %s).' % DEFAULT_TRAITS
|
90
90
|
|
91
91
|
config_param :connection_type, :bool, :default => DEFAULT_CONNECTION_TYPE,
|
92
|
-
:desc => ''
|
92
|
+
:desc => 'If true, to get connection type information (default: %s).' % DEFAULT_CONNECTION_TYPE
|
93
93
|
|
94
94
|
def initialize
|
95
95
|
super
|
@@ -98,46 +98,6 @@ module Fluent
|
|
98
98
|
def configure(conf)
|
99
99
|
super
|
100
100
|
|
101
|
-
@enable_auto_download = conf.has_key?('enable_auto_download') ? conf['enable_auto_download'] : DEFAULT_ENABLE_DOWNLOAD
|
102
|
-
|
103
|
-
@md5_url = conf.has_key?('md5_url') ? conf['md5_url'] : DEFAULT_MD5_URL
|
104
|
-
|
105
|
-
@download_url = conf.has_key?('download_url') ? conf['download_url'] : DEFAULT_DOWNLOAD_URL
|
106
|
-
|
107
|
-
@md5_path = conf.has_key?('md5_path') ? conf['md5_path'] : DEFAULT_MD5_PATH
|
108
|
-
|
109
|
-
@database_path = conf.has_key?('database_path') ? conf['database_path'] : DEFAULT_DATABASE_PATH
|
110
|
-
|
111
|
-
@lookup_field = conf.has_key?('lookup_field') ? conf['lookup_field'] : DEFAULT_LOOKUP_FIELD
|
112
|
-
|
113
|
-
@output_field = conf.has_key?('output_field') ? conf['output_field'] : DEFAULT_OUTPU_FIELD
|
114
|
-
|
115
|
-
@field_delimiter = conf.has_key?('field_delimiter') ? conf['field_delimiter'] : DEFAULT_FIELD_DELIMITER
|
116
|
-
|
117
|
-
@flatten = conf.has_key?('flatten') ? to_boolean(conf['flatten']) : DEFAULT_FLATTEN
|
118
|
-
|
119
|
-
@locale = conf.has_key?('locale') ? conf['locale'] : DEFAULT_LOCALE
|
120
|
-
|
121
|
-
@continent = conf.has_key?('continent') ? to_boolean(conf['continent']) : DEFAULT_CONTINENT
|
122
|
-
|
123
|
-
@country = conf.has_key?('country') ? to_boolean(conf['country']) : DEFAULT_COUNTRY
|
124
|
-
|
125
|
-
@city = conf.has_key?('city') ? to_boolean(conf['city']) : DEFAULT_CITY
|
126
|
-
|
127
|
-
@location = conf.has_key?('location') ? to_boolean(conf['location']) : DEFAULT_LOCATION
|
128
|
-
|
129
|
-
@postal = conf.has_key?('postal') ? to_boolean(conf['postal']) : DEFAULT_POSTAL
|
130
|
-
|
131
|
-
@registered_country = conf.has_key?('registered_country') ? to_boolean(conf['registered_country']) : DEFAULT_REGISTERED_COUNTRY
|
132
|
-
|
133
|
-
@represented_country = conf.has_key?('represented_country') ? to_boolean(conf['represented_country']) : DEFAULT_REPRESENTED_COUNTRY
|
134
|
-
|
135
|
-
@subdivisions = conf.has_key?('subdivisions') ? to_boolean(conf['subdivisions']) : DEFAULT_SUBDIVISIONS
|
136
|
-
|
137
|
-
@traits = conf.has_key?('traits') ? to_boolean(conf['traits']) : DEFAULT_TRAITS
|
138
|
-
|
139
|
-
@connection_type = conf.has_key?('connection_type') ? to_boolean(conf['connection_type']) : DEFAULT_CONNECTION_TYPE
|
140
|
-
|
141
101
|
if enable_auto_download then
|
142
102
|
download_database @download_url, @md5_url, @database_path, @md5_path
|
143
103
|
end
|
@@ -152,8 +112,6 @@ module Fluent
|
|
152
112
|
geoip = @database.lookup(ip)
|
153
113
|
|
154
114
|
if geoip.found? then
|
155
|
-
#geoip_hash = geoip.to_hash
|
156
|
-
|
157
115
|
if @continent then
|
158
116
|
continent_hash = {}
|
159
117
|
|