logstash/conf.d/billing.conf
2025-02-18 16:02:34 +03:00

157 lines
3.6 KiB
Plaintext

# billing.conf
#
input {
jdbc{
jdbc_driver_library => "/etc/logstash/libs/postgresql-42.2.20.jar"
jdbc_driver_class => "org.postgresql.Driver"
schedule => "* * * * *"
jdbc_connection_string => "jdbc:postgresql://pg.billing.simfony.rocks/dev_opencell"
jdbc_user => "meveo"
jdbc_password => "cg2yFnRnDeAqwUH8"
statement => "select * from vw_billing_wallet_operation_with_edr where created > :sql_last_value"
use_column_value => true
tracking_column => "created"
tracking_column_type => "timestamp"
last_run_metadata_path => "/home/logstash/.logstash_jdbc_last_run_wallet_view"
}
}
filter
{
clone {
clones => ['wallet_operation', 'edr']
}
if [type] == 'wallet_operation' {
prune {
whitelist_names => [
'id',
'operation_type',
'version',
'created',
'updated',
'code',
'description',
'amount_tax',
'amount_with_tax',
'amount_without_tax',
'end_date',
'offer_code',
'operation_date',
'parameter_1',
'parameter_2',
'parameter_3',
'quantity',
'start_date',
'status',
'subscription_date',
'tax_percent',
'credit_debit_flag',
'unit_amount_tax',
'unit_amount_with_tax',
'unit_amount_without_tax',
'charge_instance_id',
'counter_id',
'currency_id',
'priceplan_id',
'reratedwalletoperation_id',
'seller_id',
'wallet_id',
'reservation_id',
'invoicing_date',
'input_quantity',
'input_unit_description',
'rating_unit_description',
'edr_id',
'order_number',
'parameter_extra',
'raw_amount_without_tax',
'raw_amount_with_tax',
'invoice_sub_category_id',
'subscription_id',
'tax_id',
'rated_transaction_id',
'service_instance_id',
'offer_id',
'input_unitofmeasure',
'rating_unitofmeasure',
'tax_class_id',
'uuid',
'cf_values',
'cf_values_accum',
'sort_index',
'billing_account_id',
'billing_run_id',
'billing_cycle_id',
'access_user_id'
]
}
mutate {
add_field => { "[@metadata][type]" => "wallet_operation" }
}
}
else if [type] == 'edr' {
prune {
whitelist_names => [
'edr_id',
'edr_version',
'edr_created',
'edr_event_date',
'edr_last_updated',
'edr_origin_batch',
'edr_origin_record',
'edr_parameter_1',
'edr_parameter_2',
'edr_parameter_3',
'edr_parameter_4',
'edr_quantity',
'edr_reject_reason',
'edr_status',
'edr_subscription_id',
'edr_parameter_5',
'edr_parameter_6',
'edr_parameter_7',
'edr_parameter_8',
'edr_parameter_9',
'edr_date_parameter_1',
'edr_date_parameter_2',
'edr_date_parameter_3',
'edr_date_parameter_4',
'edr_date_parameter_5',
'edr_decimal_parameter_1',
'edr_decimal_parameter_2',
'edr_decimal_parameter_3',
'edr_decimal_parameter_4',
'edr_decimal_parameter_5',
'edr_access_code',
'edr_header_edr_id',
'edr_extra_parameter',
'access_user_id'
]
}
mutate {
add_field => { "[@metadata][type]" => "edr" }
}
}
}
output {
if [@metadata][type] == 'wallet_operation' {
elasticsearch {
hosts => ["http://10.12.174.15:9200","http://10.12.174.16:9200","http://10.12.174.17:9200"]
user => "logstash_internal"
password => "vK54tBEFUZaKBVtwsmlHksbr07Rm8cTn"
index => "simfony-wallet-billing"
}
} else if [@metadata][type] == 'edr' {
elasticsearch {
hosts => ["http://10.12.174.15:9200","http://10.12.174.16:9200","http://10.12.174.17:9200"]
user => "logstash_internal"
password => "vK54tBEFUZaKBVtwsmlHksbr07Rm8cTn"
index => "simfony-edr-billing"
}
}
}