input {
jdbc {
jdbc_driver_library => "/usr/share/logstash/logstash-core/lib/jars/postgresql-42.7.3.jar"
jdbc_driver_class => "org.postgresql.Driver"
jdbc_connection_string => "jdbc:postgresql://db_ip:5432/cag"
jdbc_user => "logstash"
jdbc_password => "mypassword"
schedule => "*/2 * * * *" # runs every minute
statement => "SELECT * FROM auth_lists WHERE id > :sql_last_value"
use_column_value => true
tracking_column => "id"
tracking_column_type => "numeric"
last_run_metadata_path => "/var/lib/logstash/.logstash_jdbc_last_run"
#statement => "SELECT * FROM auth_lists;"
}
}
filter {
translate {
field => "device_ip_address"
destination => "location"
dictionary_path => "/usr/share/logstash/ip_location.yml"
exact => true
fallback => "unknown"
}
}
output {
elasticsearch {
hosts => ["https://ec1:9200","https://ec2:9200"]
ssl_certificate_authorities => '/etc/logstash/certs/http_ca.crt'
user => "logstash_user"
password => "mypassword"
manage_template => false
data_stream => false
#index => "postgres-data"
#index => "log-cag-db-%{+YYYY.MM.dd}"
ilm_rollover_alias => "log-cag-db"
ilm_pattern => "{now/d}-000001"
ilm_enabled => "true"
ilm_policy => "cag-db_policy"
}
}
example of ip_location.yml file:
"10.xx.xx.13": " CAG-New Delhi-New_Building-2F"
"10.xx.xx.14": " CAG-New Delhi-New_Building-5F"
"10.xx.xx.15": " CAG-New Delhi-New_Building-3F"
why it is not working