@Tags(value={"lookup","enrich","ip","geo","ipgeo","maxmind","isp","domain","cellular","anonymous","tor"}) @CapabilityDescription(value="A lookup service that provides several types of enrichment information for IP addresses. The service is configured by providing a MaxMind Database file and specifying which types of enrichment should be provided for an IP Address or Hostname. Each type of enrichment is a separate lookup, so configuring the service to provide all of the available enrichment data may be slower than returning only a portion of the available enrichments. In order to use this service, a lookup must be performed using key of \'ip\' and a value that is a valid IP address or hostname. View the Usage of this component and choose to view Additional Details for more information, such as the Schema that pertains to the information that is returned.") public class IPLookupService extends AbstractControllerService implements RecordLookupService
| Modifier and Type | Field and Description |
|---|---|
private String |
databaseChecksum |
private String |
databaseFile |
private long |
databaseLastRefreshAttempt |
private com.maxmind.geoip2.DatabaseReader |
databaseReader |
private Lock |
dbWriteLock |
(package private) static PropertyDescriptor |
GEO_DATABASE_FILE |
private static String |
IP_KEY |
(package private) static PropertyDescriptor |
LOOKUP_ANONYMOUS_IP_INFO |
(package private) static PropertyDescriptor |
LOOKUP_CITY |
(package private) static PropertyDescriptor |
LOOKUP_CONNECTION_TYPE |
(package private) static PropertyDescriptor |
LOOKUP_DOMAIN |
(package private) static PropertyDescriptor |
LOOKUP_ISP |
(package private) static long |
REFRESH_THRESHOLD_MS |
private static Set<String> |
REQUIRED_KEYS |
| Constructor and Description |
|---|
IPLookupService() |
| Modifier and Type | Method and Description |
|---|---|
void |
closeReader() |
private Record |
createContainerRecord(Record geoRecord,
Record ispRecord,
String domainName,
String connectionType,
Record anonymousIpRecord) |
private Record |
createRecord(com.maxmind.geoip2.model.AnonymousIpResponse anonymousIp) |
private Record |
createRecord(com.maxmind.geoip2.model.CityResponse city) |
private Record |
createRecord(com.maxmind.geoip2.record.Country country) |
private Record |
createRecord(com.maxmind.geoip2.model.IspResponse isp) |
private Record |
createRecord(com.maxmind.geoip2.record.Subdivision subdivision) |
private Optional<Record> |
doLookup(com.maxmind.geoip2.DatabaseReader databaseReader,
Map<String,Object> coordinates) |
private String |
getChecksum(File file) |
Set<String> |
getRequiredKeys() |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
private void |
loadDatabase(File dbFile,
String dbFileChecksum) |
Optional<Record> |
lookup(Map<String,Object> coordinates) |
void |
onEnabled(ConfigurationContext context) |
private void |
refreshDatabase() |
private boolean |
shouldAttemptDatabaseRefresh() |
abstractClearConfigContext, abstractStoreConfigContext, disabled, enabled, getConfigurationContext, getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, getProperty, getStateManager, init, initialize, isEnabledcustomValidate, equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, onPropertyModified, toString, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetValueTypelookupinitialize, isStatefulgetIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateprivate volatile String databaseFile
private static final String IP_KEY
private volatile com.maxmind.geoip2.DatabaseReader databaseReader
private volatile String databaseChecksum
private volatile long databaseLastRefreshAttempt
private final Lock dbWriteLock
static final long REFRESH_THRESHOLD_MS
static final PropertyDescriptor GEO_DATABASE_FILE
static final PropertyDescriptor LOOKUP_CITY
static final PropertyDescriptor LOOKUP_ISP
static final PropertyDescriptor LOOKUP_DOMAIN
static final PropertyDescriptor LOOKUP_CONNECTION_TYPE
static final PropertyDescriptor LOOKUP_ANONYMOUS_IP_INFO
protected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponent@OnEnabled public void onEnabled(ConfigurationContext context) throws IOException
IOExceptionprivate String getChecksum(File file) throws IOException
IOException@OnStopped public void closeReader() throws IOException
IOExceptionpublic Set<String> getRequiredKeys()
getRequiredKeys in interface LookupService<Record>public Optional<Record> lookup(Map<String,Object> coordinates) throws LookupFailureException
lookup in interface LookupService<Record>LookupFailureExceptionprivate Optional<Record> doLookup(com.maxmind.geoip2.DatabaseReader databaseReader, Map<String,Object> coordinates) throws LookupFailureException, com.maxmind.db.InvalidDatabaseException
LookupFailureExceptioncom.maxmind.db.InvalidDatabaseExceptionprivate boolean shouldAttemptDatabaseRefresh()
private void refreshDatabase()
throws IOException
IOExceptionprivate void loadDatabase(File dbFile, String dbFileChecksum) throws IOException
IOExceptionprivate Record createRecord(com.maxmind.geoip2.model.CityResponse city)
private Record createRecord(com.maxmind.geoip2.record.Subdivision subdivision)
private Record createRecord(com.maxmind.geoip2.record.Country country)
private Record createRecord(com.maxmind.geoip2.model.IspResponse isp)
private Record createRecord(com.maxmind.geoip2.model.AnonymousIpResponse anonymousIp)
Copyright © 2022 Apache NiFi Project. All rights reserved.