Closed systemcrash closed 5 months ago
Thank you Paul @systemcrash for this wonderful, full round contribution!
Q: Any reason this should not be a plugin rather than a native module? Most optional parsers are published as plugins.
Q: Any reason this should not be a plugin rather than a native module? Most optional parsers are published as plugins.
I wrote it two years ago while everything was like that. I tested it with master and it still works fine. Are there any important things I should be aware of to make it as a plugin? Or is it just a question of changing folders? I tried just changing folders and got some weird stackdumps>
Loading npm module... @pastash/filter_app_ingate
[Thu, 27 May 2021 12:16:33 GMT] ERROR Unable to load urls from command line
[Thu, 27 May 2021 12:16:33 GMT] ERROR TypeError: Cannot read property 'create' of undefined
at LogstashAgent.configure (/usr/src/app/lib/agent.js:143:21)
at LogstashAgent.<anonymous> (/usr/src/app/lib/agent.js:215:10)
at /usr/src/app/node_modules/async/dist/async.js:3096:16
at replenish (/usr/src/app/node_modules/async/dist/async.js:998:17)
at iterateeCallback (/usr/src/app/node_modules/async/dist/async.js:983:17)
at /usr/src/app/node_modules/async/dist/async.js:958:16
at LogstashAgent.<anonymous> (/usr/src/app/lib/agent.js:265:5)
at LogstashAgent.<anonymous> (/usr/src/app/lib/agent.js:220:7)
at LogstashAgent.<anonymous> (/usr/src/app/lib/agent.js:156:9)
at FilterMultiline.<anonymous> (/usr/src/app/lib/lib/base_filter.js:36:5)
🤷
changed also header to:
var base_filter = require('@pastash/pastash').base_filter,
util = require('util'),
logger = require('@pastash/pastash').logger;
which seems to be the source of the crash.
It's a TINY bit more involved than just changing folders, but really just about importing the pastash base filter. You can take any relevant example plugin filter as example: https://github.com/sipcapture/paStash/tree/next/plugins/filters
var base_filter = require('@pastash/pastash').base_filter, util = require('util'), logger = require('@pastash/pastash').logger;<br class="Apple-interchange-newline">
It's a TINY bit more involved than just changing folders, but really just about importing the pastash base filter. You can take any relevant example plugin filter as example: https://github.com/sipcapture/paStash/tree/next/plugins/filters
var base_filter = require('@pastash/pastash').base_filter, util = require('util'), logger = require('@pastash/pastash').logger;<br class="Apple-interchange-newline">
I guess it should be - but... same crash with those imports (whether or not I move the js to plugins from lib/filter). I've been comparing to other plugins - some of the docs say I should install them - but I docker-compose up --build
. Usually works fine, except for here 🤣
No problem! I can give this a try this weekend, thanks again for contributing this back!!
Should we just mash it in and you try to pluginify it?
Did you manage to give it a try?
@systemcrash more or less yeah, but things got busy - please keep this PR open and I'll share a gist - would still like for you to be able to PR it since its your work :)
Sooner the better :) but no pressure. Mainly curious what plugins mandate more than the old structure.
Did it get messy? 🍰
@systemcrash you know how we do :)
I don't want to take credit for this, so just opened/closed to share what I thought would work in https://github.com/sipcapture/paStash/pull/96/files (I assume this is the same as you were doing, the only issue was the missing global regex? also ignore the mqtt patch clearly was there by mistake)
Any hints on where the missing global regex was? I try to put in place your changes, and just boom same crash. Tried destroying all images and rebuilding... same. Want to test in place and confirm that your 'simple' changes are those necessary.
All plugins are the same really - is this crashing with @pastash/pastash
or a local instance?
All plugins are the same really - is this crashing with
@pastash/pastash
or a local instance?
As above
To actually check this as it would work once released, you would have to "plant" this in your global node_modules path alongside @pastash/pastash, ie /use/global/path/to/node_modules/@pastash/filter_app_ingate
and then run the recipe
I'm building an image via docker-compose
, and never had to do that before..... 🤷
It's the same result whichever app_*
from plugins that I invoke. Nothing via docker-compose works, without some extra magic, which I do not know.
But it works as a core app.
Edit: maybe something from Dockerfile is missing. But basically, I don't know how to do
...you would have to "plant" this in your global node_modules path alongside @pastash/pastash, ie
/use/global/path/to/node_modules/@pastash/filter_app_ingate
and then run the recipe
Welp, I'm OK with this being a plugin, but I can't get paStash to work with any plugin in the container environment without a bit of extra guidance. It seems some special sauce to get those environments working automatically is necessary.
Hey @systemcrash I promise to dedicate this some time asap but you are right, plugins are really hard to test before they are published to npm unless you manually "simulate" an npm global install by copying them into the expected path - will fix!
Hey @systemcrash I promise to dedicate this some time asap but you are right, plugins are really hard to test before they are published to npm unless you manually "simulate" an npm global install by copying them into the expected path - will fix!
Ok - thanks. I consider this low prio; it's not like people are screaming for syslog handling on older Ingate firmwares. But if 'simulating' manually is the only way to get paStash working with its own plugins....
Adds filter_app_ingate.js and an example conf for TCP and UDP.