Great! It's a good start. Thank you.
Now I would like to focus on that line, because I have read about different ways to send a .csv
file to ELK (Logstash, Filebeat, ES Node Ingest Pipelines, etc...), but I want to focus in just one way.
Can you please check my config file below, where I'm using just the CSV filter and not the CSV codec, and see if there is something wrong with it or if I am missing anything or using deprecated names/configs?
I just noticed that when I run Logstash, the index template included in the config template_name => "ts_reports"
it is added but empty. I delete it every time and every time it's being added again, so that's working, but for some unknown reason for me, it is not including the template body.
Perhaps that's what is failing. If you can, please take a look as well.
Thank you in advance
ts_reports.conf
input {
file {
id => "TS_Reports"
path => "/opt/ts_reports/*.csv"
# codec => "csv"
mode => "read"
start_position => "beginning"
file_completed_action => "delete"
type => "TS"
}
}
filter {
csv {
columns => [
"Time",
"Device",
"Source IP",
"Source Port",
"Destination IP",
"Destination Port",
"Action",
"Direction",
"Targets",
"ID"
]
separator => ","
}
}
output {
elasticsearch {
hosts => ["https://127.0.0.1:9200"]
index => "ts_reports-%{+YYYY.MM}"
manage_template => true
template => "/etc/logstash/ts_reports-template.json"
template_name => "ts_reports"
user => "logstash_internal"
password => "[PASSWORD]"
ssl => true
ssl_certificate_verification => true
cacert => "/etc/logstash/certs/elasticsearch-ca.pem"
}
}
ts_reports-template.json
{
"index_patterns" : ["ts_reports-*"],
"template": {
"settings": {
"index.number_of_replicas": 0,
"index.refresh_interval" : "5s"
},
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
},
"Action": {
"type": "keyword"
},
"Destination IP": {
"type": "ip"
},
"Destination Port": {
"type": "long"
},
"Device": {
"type": "keyword"
},
"Direction": {
"type": "keyword"
},
"ID": {
"type": "keyword"
},
"Source IP": {
"type": "ip"
},
"Source Port": {
"type": "long"
},
"Targets": {
"type": "keyword"
},
"Time": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss"
}
}
}
}
}
pipelines.yaml
- pipeline.id: main
path.config: "/etc/logstash/conf.d/*.conf"
- pipeline.id: ts_reports
path.config: "/etc/logstash/conf.d/ts_reports/ts_reports.conf"