We want to use filebeat to gather mysql slow log. I want to create a filebeat processor to convert mysql slow log to json format and add a sql fingerprint field.
I find a related issue here: https://github.com/elastic/beats/issues/6760
I follow up the issue but encounter an error:
[root@c3-b2c-dba-dbshard17 filebeat-7.4.0]# ./filebeat -e -c filebeat.yml --plugin sql_fingerprint.so
Exiting: plugin.Open("sql_fingerprint"): plugin was built with a different version of package github.com/elastic/beats/libbeat/common/file
We use filebeat 7.4.0 version online, I find that this version filebeat is compiled by go 1.12.9.
[root@c3-b2c-dba-dbshard17 filebeat-7.4.0]# ./filebeat version
filebeat version 7.4.0 (amd64), libbeat 7.4.0 [f940c36884d3749901a9c99bea5463a6030cdd9c built 2019-09-27 07:45:44 +0000 UTC]
git checkout f940c36884d3749901a9c99bea5463a6030cdd9c
[root@sgp2-b2c-b2cop-beta-neo-node01 beats]# cat .go-version
1.12.9
The steps I use to create processor:
- Install go 1.12.9
- git clone filebeat repo
- git checout f940c36884d3749901a9c99bea5463a6030cdd9c
- write code in {go/src}github.com/elastic/beats/filebeat/processor/sql_fingerprint
- cd {go/src}github.com/elastic/beats/filebeat/processor/sql_fingerprint and build plugin with:
GO111MODULE=on go build -mod=vendor -buildmode=plugin - use the sql_fingerprint.so generated by step 4 and run:
[root@c3-b2c-dba-dbshard17 filebeat-7.4.0]# ./filebeat -e -c filebeat.yml --plugin sql_fingerprint.so
Exiting: plugin.Open("sql_fingerprint"): plugin was built with a different version of package github.com/elastic/beats/libbeat/common/file
Help.