DaveB93
(Dave B93)
September 12, 2018, 6:10pm
1
Hi There,
I was attempting to create a plugin for graylog, and had some issues with the documentation here: http://docs.graylog.org/en/latest/pages/plugins.html
It’s telling me after I clone the graylog-project.git I should run $ scripts/bootstrap but that doesn’t exist.
Following the instructions on the graylog-project github project I got the graylog-project-cli from github and ran this instead
graylog-project bootstrap --manifest=“manifests/2.4.json” github://Graylog2/graylog-project.git
but now I’m wondering if there’s a way that I can do the equivalent of what the docs are telling me to do here:
scripts/bootstrap-plugin jira-alarmcallback
What I’ve done for now is cd to graylog-project-repos
git clone git@github.com :Graylog2/graylog-plugin-sample.git
But it looks like a LOT of search and rename, as well as moving files around will be required to modify this plugin to be it’s own entity.
Is this the recommended workflow?
derPhlipsi
(Philipp Ruland)
September 12, 2018, 8:36pm
2
Heyo,
the closest to up-to-date would probably be something like this:
I recently went through the process of setting up a development environment for graylog so I can start learning how to create plugins. I performed the following steps on a Fedora 28 VM but they should be similar on other Distros. I disabled selinux for this environment. Normally, I leave selinux enabled but it gave me some issues that still need sorting out.
The first step after VM creation was to install all the prereq software.
java-1.8-0-openjdk + devel
git
maven
nodejs
InteliJ idea
I add…
Greetings,
Philipp
1 Like
DaveB93
(Dave B93)
September 12, 2018, 9:19pm
3
I saw that, and it was helpful for getting the right branch set up with the bootstrap but it doesn’t actually detail bootstrapping a plugin at all.
The sample plugin does build there, but I’m not entirely sure everything I have to rename to get it to build my own plugin.jar
incidentally if someone does try bootstrapping but doesn’t specify the branch, then building the sample plugin does not work. for some reason you need to actually install yarn on the system. ( it seems like one of the scripts doesn’t reference yarn properly ) and you need to override which version of node is downloaded in the sample plugins pom.xml
DaveB93
(Dave B93)
September 12, 2018, 9:49pm
4
in case anyone else was trying to write a plugin, here are some resources that I found helpful.
opened 03:17PM - 01 Nov 16 UTC
closed 07:59AM - 02 Nov 16 UTC
## Expected Behavior
After cloning graylog-project and running ./scripts/bootst… rap, running./scripts/bootstrap-plugin [plugin-name] should run successfully
## Current Behavior
At the webpack step, it is unable to find vendor-manifest.json, and fails.
## Context
This only popped up in the last week or so, so I'm not particularly sure why I'm only seeing this issue now and didn't see it before. While it is possible to develop plugins without this system, it's made significantly easier by having an automated way to setup the environment.
## Steps to Reproduce
1. git clone git@github.com:Graylog2/graylog-project.git && cd graylog-project
2. ./scripts/bootstrap
3. ./scripts/bootstrap-plugin [plugin-name]
### Output:
>[ERROR] module.js:327
[ERROR] throw err;
[ERROR] ^
[ERROR]
[ERROR] Error: Cannot find module 'C:\Users\jmcmichael\Desktop\Plugins\graylog-project\graylog2-server\graylog2-web-interface\manifests\vendor-manifest.json'
[ERROR] at Function.Module._resolveFilename (module.js:325:15)
[ERROR] at Function.Module._load (module.js:276:25)
[ERROR] at Module.require (module.js:353:17)
[ERROR] at require (internal/module.js:12:17)
[ERROR] at new PluginWebpackConfig (C:\Users\jmcmichael\Desktop\Plugins\graylog-project\graylog-plugin-notification-subscription\node_modules\graylog-web-plugin\lib\PluginWebpackConfig.js:21:25)
[ERROR] at Object.<anonymous> (C:\Users\jmcmichael\Desktop\Plugins\graylog-project\graylog-plugin-notification-subscription\webpack.config.js:6:18)
[ERROR] at Module._compile (module.js:409:26)
[ERROR] at Object.Module._extensions..js (module.js:416:10)
[ERROR] at Module.load (module.js:343:32)
[ERROR] at Function.Module._load (module.js:300:12)
[ERROR] at Module.require (module.js:353:17)
[ERROR] at require (internal/module.js:12:17)
[ERROR] at module.exports (C:\Users\jmcmichael\Desktop\Plugins\graylog-project\graylog-plugin-notification-subscription\node_modules\webpack\bin\convert-argv.js:80:13)
[ERROR] at Object.<anonymous> (C:\Users\jmcmichael\Desktop\Plugins\graylog-project\graylog-plugin-notification-subscription\node_modules\webpack\bin\webpack.js:39:40)
[ERROR] at Module._compile (module.js:409:26)
[ERROR] at Object.Module._extensions..js (module.js:416:10)
[ERROR]
[ERROR] npm ERR! Windows_NT 6.1.7601
[ERROR] npm ERR! argv "C:\\Users\\jmcmichael\\Desktop\\Plugins\\graylog-project\\graylog-plugin-notification-subscription\\node\\node.exe" "C:\\Users\\jmcmichael\\Desktop\\Plugins\\graylog-project\\graylog-plugin-notification-subscription\\node\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
[ERROR] npm ERR! node v4.4.3
[ERROR] npm ERR! npm v3.8.6
[ERROR] npm ERR! code ELIFECYCLE
[ERROR] npm ERR! NotificationSubscription@1.0.0-SNAPSHOT build: `webpack`
[ERROR] npm ERR! Exit status 1
[ERROR] npm ERR!
[ERROR] npm ERR! Failed at the NotificationSubscription@1.0.0-SNAPSHOT build script 'webpack'.
[ERROR] npm ERR! Make sure you have the latest version of node.js and npm installed.
[ERROR] npm ERR! If you do, this is most likely a problem with the NotificationSubscription package,
[ERROR] npm ERR! not with npm itself.
[ERROR] npm ERR! Tell the author that this fails on your system:
[ERROR] npm ERR! webpack
[ERROR] npm ERR! You can get information on how to open an issue for this project with:
[ERROR] npm ERR! npm bugs NotificationSubscription
[ERROR] npm ERR! Or if that isn't available, you can get their info via:
[ERROR] npm ERR! npm owner ls NotificationSubscription
[ERROR] npm ERR! There is likely additional logging output above.
[ERROR]
[ERROR] npm ERR! Please include the following file with any support request:
[ERROR] npm ERR! C:\Users\jmcmichael\Desktop\Plugins\graylog-project\graylog-plugin-notification-subscription\npm-debug.log
### npm-debug.log
>0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Users\\jmcmichael\\Desktop\\Plugins\\graylog-project\\graylog-plugin-notification-subscription\\node\\node.exe',
1 verbose cli 'C:\\Users\\jmcmichael\\Desktop\\Plugins\\graylog-project\\graylog-plugin-notification-subscription\\node\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using npm@3.8.6
3 info using node@v4.4.3
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle NotificationSubscription@1.0.0-SNAPSHOT~prebuild: NotificationSubscription@1.0.0-SNAPSHOT
6 silly lifecycle NotificationSubscription@1.0.0-SNAPSHOT~prebuild: no script for prebuild, continuing
7 info lifecycle NotificationSubscription@1.0.0-SNAPSHOT~build: NotificationSubscription@1.0.0-SNAPSHOT
8 verbose lifecycle NotificationSubscription@1.0.0-SNAPSHOT~build: unsafe-perm in lifecycle true
9 verbose lifecycle NotificationSubscription@1.0.0-SNAPSHOT~build: PATH: C:\Users\jmcmichael\Desktop\Plugins\graylog-project\graylog-plugin-notification-subscription\node\node_modules\npm\bin\node-gyp-bin;C:\Users\jmcmichael\Desktop\Plugins\graylog-project\graylog-plugin-notification-subscription\node_modules\.bin;C:\Users\jmcmichael\Desktop\Plugins\graylog-project\graylog-plugin-notification-subscription\node;C:\Users\jmcmichael\Desktop\Plugins\graylog-project\graylog-plugin-notification-subscription\node;C:\Users\jmcmichael\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\jmcmichael\bin;C:\Python27;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn;C:\Program Files\Microsoft SQL Server\100\Tools\Binn;C:\Program Files\Microsoft SQL Server\100\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\12.0\DLLShared;C:\Program Files (x86)\Roxio\OEM\AudioCore;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0;C:\Program Files\Microsoft SQL Server\110\Tools\Binn;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Go\bin;C:\Users\jmcmichael\work\bin;C:\Program Files (x86)\WinMerge;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files (x86)\Plex\Plex Manufacturing Cloud\1.4.0.1;C:\Program Files\MongoDB\bin;C:\Program Files\ElasticSearch\bin;C:\Program Files\RabbitMQ Server\rabbitmq_server-3.6.5\sbin;C:\Program Files\Maven\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit;C:\Program Files\Oracle\VirtualBox;%USERPROFILE%\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio;C:\Users\jmcmichael\AppData\Roaming\npm;C:\Program Files\nodejs;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl;
10 verbose lifecycle NotificationSubscription@1.0.0-SNAPSHOT~build: CWD: C:\Users\jmcmichael\Desktop\Plugins\graylog-project\graylog-plugin-notification-subscription
11 silly lifecycle NotificationSubscription@1.0.0-SNAPSHOT~build: Args: [ '/d /s /c', 'webpack' ]
12 silly lifecycle NotificationSubscription@1.0.0-SNAPSHOT~build: Returned: code: 1 signal: null
13 info lifecycle NotificationSubscription@1.0.0-SNAPSHOT~build: Failed to exec build script
14 verbose stack Error: NotificationSubscription@1.0.0-SNAPSHOT build: `webpack`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (C:\Users\jmcmichael\Desktop\Plugins\graylog-project\graylog-plugin-notification-subscription\node\node_modules\npm\lib\utils\lifecycle.js:239:16)
14 verbose stack at emitTwo (events.js:87:13)
14 verbose stack at EventEmitter.emit (events.js:172:7)
14 verbose stack at ChildProcess.<anonymous> (C:\Users\jmcmichael\Desktop\Plugins\graylog-project\graylog-plugin-notification-subscription\node\node_modules\npm\lib\utils\spawn.js:24:14)
14 verbose stack at emitTwo (events.js:87:13)
14 verbose stack at ChildProcess.emit (events.js:172:7)
14 verbose stack at maybeClose (internal/child_process.js:827:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
15 verbose pkgid NotificationSubscription@1.0.0-SNAPSHOT
16 verbose cwd C:\Users\jmcmichael\Desktop\Plugins\graylog-project\graylog-plugin-notification-subscription
17 error Windows_NT 6.1.7601
18 error argv "C:\\Users\\jmcmichael\\Desktop\\Plugins\\graylog-project\\graylog-plugin-notification-subscription\\node\\node.exe" "C:\\Users\\jmcmichael\\Desktop\\Plugins\\graylog-project\\graylog-plugin-notification-subscription\\node\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
19 error node v4.4.3
20 error npm v3.8.6
21 error code ELIFECYCLE
22 error NotificationSubscription@1.0.0-SNAPSHOT build: `webpack`
22 error Exit status 1
23 error Failed at the NotificationSubscription@1.0.0-SNAPSHOT build script 'webpack'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the NotificationSubscription package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error webpack
23 error You can get information on how to open an issue for this project with:
23 error npm bugs NotificationSubscription
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls NotificationSubscription
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
( basically this says, after you’ve bootstrapped graylog, if you want to compile your plugin without compiling graylog, you should run “mvn generate-resources” in the graylog-project-repos/graylog-project folder )
In this post, we will go through creating your own processing pipeline function. Some Java experience will be helpful, but not necessary. We will be taking it step-by-step from understanding a pipeline, to implementing and installing your function.
Est. reading time: 6 minutes
How to hook your plugin into graylog
Make sure that you’re using a shared classloader for your plugin.
if your plugin depends on graylog, then you need to set isolated=false in your graylog-plugin.properties file
2 Likes
system
(system)
Closed
September 26, 2018, 9:50pm
5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.