Hi everyone,
I'd like to ask for some help from you please about adding additional fields to Logstash Kinesis Input.
I have three logstash servers consuming a Kinesis Stream using Kinesis Input Plugin.
Example like the below:-
input {
kinesis {
application_name => "test-kinesis"
kinesis_stream_name => "test-kinesis"
region => "ap-southeast-1"
profile => "test-kinesis"
initial_position_in_stream => "TRIM_HORIZON"
codec => cloudwatch_logs
id => "kinesis-rq-log-in"
}
}
At each time only one server is reading until it fails. However, the document from the index only contains the information from the record.
{
"_index": "linux-default-2020.06.29",
"_type": "doc",
"_id": "pLHfAHMBpFWsf2X_halE",
"_version": 1,
"_score": null,
"_source": {
"message": "sanitised linux message",
"@timestamp": "2020-06-29T16:18:34.923Z",
"tags": [
"kinesis_syslog"
],
"subscriptionFilters": [
"cloudwatchsubscriptionfilter"
],
"@version": "1",
"awsid": "1234567891011",
"messageType": "DATA_MESSAGE",
"logStream": "myhostname,i-1234567abcedfg",
"logGroup": "/var/log/audit/audit.log"
},
"fields": {
"@timestamp": [
"2020-06-29T16:18:34.923Z"
]
},
"sort": [
1593447514923
]
}
Since it does not have any information about the logstash server itself, I don't know which server is the current consumer of the stream.
May I ask if there is a way to use 'add_field' to add a new field to the document, for example the IP or the hostname of the logstash collector? Obviously I can add a static field but since I wonder if I could dynamically acquire the information without hard code this into the configuration.
Many thanks in advance,
James Ren