README.md in fluent-plugin-geoip-0.4.0 vs README.md in fluent-plugin-geoip-0.5.0.beta
- old
+ new
@@ -14,13 +14,15 @@
before use, install dependent library as:
```bash
# for RHEL/CentOS
+$ sudo yum group install "Development Tools"
$ sudo yum install geoip-devel --enablerepo=epel
# for Ubuntu/Debian
+$ sudo apt-get install build-essential
$ sudo apt-get install libgeoip-dev
```
## Installation
@@ -65,10 +67,13 @@
# Settings for tag
remove_tag_prefix access.
tag geoip.${tag}
+ # To avoid get stacktrace error with `[null, null]` array for elasticsearch.
+ skip_adding_null_record true
+
# Set log_level for fluentd-v0.10.43 or earlier (default: warn)
log_level info
# Set buffering time (default: 0s)
flush_interval 1s
@@ -106,16 +111,19 @@
# lat lon as string
# ex. "37.4192008972168,-122.05740356445312"
location_string ${latitude["host"]},${longitude["host"]}
- # lat lon as array (it is useful for Kibana's bettermap.)
+ # GeoJSON (lat lon as array) is useful for Kibana's bettermap.
# ex. [-122.05740356445312, 37.4192008972168]
location_array [${longitude["host"]},${latitude["host"]}]
</record>
remove_tag_prefix access.
tag geoip.${tag}
+
+ # To avoid get stacktrace error with `[null, null]` array for elasticsearch.
+ skip_adding_null_record true
</match>
```
On the case of using td-agent2 (v1-config), it have to quote `{ ... }` or `[ ... ]` block with quotation like below.
@@ -128,10 +136,11 @@
location_string ${latitude["host"]},${longitude["host"]}
location_array '[${longitude["host"]},${latitude["host"]}]'
</record>
remove_tag_prefix access.
tag geoip.${tag}
+ skip_adding_null_record true
</match>
```
## Tutorial
@@ -180,28 +189,38 @@
For more details of geoip data format is described at the page below in section `GeoIP City Edition CSV Database Fields`.<br />
http://dev.maxmind.com/geoip/legacy/csv/
## Placeholders
-Provides these placeholders for adding field of geolocate results.
+Provides these placeholders for adding field of geolocate results.<br />
+For more example of geolocating, you can try these websites like [Geo IP Address View](http://www.geoipview.com/) or [View my IP information](http://www.geoiptool.com/en/).
-* ${city[lookup_field]}
-* ${latitude[lookup_field]}
-* ${longitude[lookup_field]}
-* ${country_code3[lookup_field]}
-* ${country_code[lookup_field]}
-* ${country_name[lookup_field]}
-* ${dma_code[lookup_field]}
-* ${area_code[lookup_field]}
-* ${region[lookup_field]}
+| placeholder attributes | output example | type | note |
+|--------------------------------|-------------------|--------------|------|
+| ${city[lookup_field]} | "Ithaca" | varchar(255) | - |
+| ${latitude[lookup_field]} | 42.4277992248535 | decimal | - |
+| ${longitude[lookup_field]} | -76.4981994628906 | decimal | - |
+| ${country_code3[lookup_field]} | "USA" | varchar(3) | - |
+| ${country_code[lookup_field]} | "US" | varchar(2) | A two-character ISO 3166-1 country code |
+| ${country_name[lookup_field]} | "United States" | varchar(50) | - |
+| ${dma_code[lookup_field]} | 555 | unsigned int | **only for US** |
+| ${area_code[lookup_field]} | 607 | char(3) | **only for US** |
+| ${region[lookup_field]} | "NY" | char(2) | A two character ISO-3166-2 or FIPS 10-4 code |
+Further more specification available at http://dev.maxmind.com/geoip/legacy/csv/#GeoIP_City_Edition_CSV_Database_Fields
+
## Parameters
* `include_tag_key` (default: false)
* `tag_key`
Add original tag name into filtered record using SetTagKeyMixin.<br />
Further details are written at http://docs.fluentd.org/articles/in_exec
+
+* `skip_adding_null_record` (default: false)
+
+Skip adding geoip fields when this valaues to `true`.
+On the case of getting nothing of GeoIP info (such as local IP), it will output the original record without changing anything.
* `remove_tag_prefix`
* `remove_tag_suffix`
* `add_tag_prefix`
* `add_tag_suffix`