Hi everyone,
I'm trying to get Filebeat set up on a local Mac Mini so it will ingest log files of a process to Elasticsearch. The log files contain a custom JSON format. I got it sort of working but in Elasticsearch the timestamp of my log file was not being recognized as such so I wanted to create a custom index mapping where I explicitly declare the time field with it's format. However, I'm not able to get that working. I don't see any index being created in Elasticsearch with the setup that I have now.
First I created a custom index template in Elasticsearch as follows:
curl -X PUT "localhost:9200/_index_template/network-probe-template" -H 'Content-Type: application/json' -d'
{
"index_patterns": ["network-probe-*"],
"template": {
"settings": {
"number_of_shards": 1
},
"mappings": {
"properties": {
"@timestamp": {
"type": "date"
},
"context": {
"type": "keyword"
},
"level": {
"type": "keyword"
},
"logger": {
"type": "keyword"
},
"mdc": {
"properties": {
"responseTime": { "type": "integer" },
"reachable": { "type": "boolean"},
"server": { "type": "keyword" }
}
},
"message": {
"type": "text"
},
"thread": {
"type": "keyword"
},
"timestamp": {
"type": "date",
"format": "yyyy-MM-dd HH:mm:ss.SSS"
}
}
}
}
}
'
Next, I have a filebeat.yml file which is as follows:
filebeat.inputs:
- type: log
enabled: true
paths:
- /Users/jonck/Documents/dev/network-probe/logs/pings.log
json.keys_under_root: true
json.add_error_key: true
setup.template.settings:
index.number_of_shards: 1
setup.template.name: "network-probe-template"
setup.template.pattern: "network-probe-template-*"
setup.ilm.enabled: false # I set this to false according to what I read here: https://discuss.elastic.co/t/filebat-create-a-custom-index-on-elasticsearch/197741
output.elasticsearch:
hosts: ["localhost:9200"]
index: "network-probe-%{[beat.version]}-%{+yyyy.MM.dd}"
I am on a Mac running Catalina 10.15.7, both Elasticsearch-oss and Filebeat-oss is installed using brew and running them using brew services. Both Elasticsearch and Filebeat are versions 7.9.
I am not getting any errors in my filebeat log file, but nevertheless I am not seeing an index being created in Elasticsearch and none of my logs are being shipped to Elasticsearch.
Any help pointing me in the right direction would be much appreciated!
