I'm pretty new to both ELK and Filebeat. I'm trying to get a custom field built using a regex value. I'm having to use javascript which seems to be complicating things. I have the following regex .com/([A-Za-z0-9]+)/ it returns .com/clientname/ as a fullmatch and clientname as the group one match. The group 1 match is the desired match for the custom field. Is there a way to do that. Below is what I have in the filebeat yml.
processors:
script:
lang: javascript
id: clientid_regex
source: >
function process(event) {
var cid;
var message;
message=event.Get("message");
if ( cid = message.match(/.com/([A-Za-z0-9]+)//) ) {
event.Put("rcm.clientid", cid);
}
}
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.