Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app_audiocodes Error: Cannot find module 'filters/filter_app_audiocodes' #189

Open
myrcinos opened this issue May 4, 2024 · 5 comments
Open

Comments

@myrcinos
Copy link

myrcinos commented May 4, 2024

Hi,
I have followed the documentation and installed the app_audiocodes filter. However, when I try to run the paStash with the recommended config file it does not work. In debug mode paStash displays the following error:

/opt/pastash$ sudo pastash --config_file=/opt/pastash/audiocodes.conf --log_level debug
[Sat, 04 May 2024 15:43:23 GMT] INFO Changing log_level debug
[Sat, 04 May 2024 15:43:23 GMT] NOTICE Starting pastash 1.0.80
[Sat, 04 May 2024 15:43:23 GMT] INFO Max http socket 100
[Sat, 04 May 2024 15:43:23 GMT] INFO Loading config file : /opt/pastash/audiocodes.conf
[Sat, 04 May 2024 15:43:23 GMT] INFO File loaded, 4 urls found
[Sat, 04 May 2024 15:43:23 GMT] INFO Loading config : 7 urls
[Sat, 04 May 2024 15:43:23 GMT] DEBUG Loading urls [
'filter://add_host://',
'filter://add_timestamp://',
'filter://add_version://',
'input://udp://?host=0.0.0.0&port=514&type=syslog',
'filter://app_audiocodes://?version=7.20A.256.396&debug=false&autolocal=true&ini=%2Ftmp%2Faudiocodes.ini',
'output://stdout://',
'output://hep://?host=127.0.0.1&port=9060&hep_id=2222&dynamic_eval=%7B%22false_clauses%22%3A%5B%5D%2C%22true_clause%22%3A%7B%22op%22%3A%22!%3D%22%2C%22left%22%3A%7B%22field%22%3A%22rcinfo%22%7D%2C%22right%22%3A%7B%22value%22%3A%22undefined%22%7D%7D%7D'
]
[Sat, 04 May 2024 15:43:23 GMT] DEBUG Initializing module output
[Sat, 04 May 2024 15:43:23 GMT] INFO Initializing output Stdout
[Sat, 04 May 2024 15:43:23 GMT] DEBUG Initializing module output
[Sat, 04 May 2024 15:43:23 GMT] INFO Initializing output HEP/EEP Server
[Sat, 04 May 2024 15:43:23 GMT] INFO Start output to HEP udp to 127.0.0.1:9060
[Sat, 04 May 2024 15:43:23 GMT] DEBUG Initializing module filter
[Sat, 04 May 2024 15:43:23 GMT] INFO Initializing filter AddHost
[Sat, 04 May 2024 15:43:23 GMT] DEBUG Initializing module filter
[Sat, 04 May 2024 15:43:23 GMT] INFO Initializing filter AddTimestamp
[Sat, 04 May 2024 15:43:23 GMT] DEBUG Initializing module filter
[Sat, 04 May 2024 15:43:23 GMT] INFO Initializing filter AddVersion
[Sat, 04 May 2024 15:43:23 GMT] DEBUG Initializing module filter
[Sat, 04 May 2024 15:43:23 GMT] DEBUG no local module found filters filter_app_audiocodes Error: Cannot find module 'filters/filter_app_audiocodes'
Require stack:

  • /usr/local/lib/node_modules/@pastash/pastash/lib/agent.js
  • /usr/local/lib/node_modules/@pastash/pastash/bin/pastash
    at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
    at Module._load (node:internal/modules/cjs/loader:885:27)
    at Module.require (node:internal/modules/cjs/loader:1105:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at LogstashAgent.configure (/usr/local/lib/node_modules/@pastash/pastash/lib/agent.js:133:17)
    at LogstashAgent. (/usr/local/lib/node_modules/@pastash/pastash/lib/agent.js:215:10)
    at /usr/local/lib/node_modules/@pastash/pastash/node_modules/async/dist/async.js:3113:16
    at replenish (/usr/local/lib/node_modules/@pastash/pastash/node_modules/async/dist/async.js:1014:17)
    at /usr/local/lib/node_modules/@pastash/pastash/node_modules/async/dist/async.js:1019:9
    at eachLimit$1 (/usr/local/lib/node_modules/@pastash/pastash/node_modules/async/dist/async.js:3199:24) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    '/usr/local/lib/node_modules/@pastash/pastash/lib/agent.js',
    '/usr/local/lib/node_modules/@pastash/pastash/bin/pastash'
    ]
    }
    Loading npm module... @pastash/filter_app_audiocodes
    [Sat, 04 May 2024 15:43:23 GMT] INFO Initializing filter AppAudiocodes
    [Sat, 04 May 2024 15:43:23 GMT] INFO Initialized App Audiocodes SysLog to SIP/HEP parser
    [Sat, 04 May 2024 15:43:23 GMT] INFO Reading INI file to resolver... /tmp/audiocodes.ini
    [Sat, 04 May 2024 15:43:23 GMT] INFO INI Loaded undefined Interfaces
    [Sat, 04 May 2024 15:43:23 GMT] INFO INI Loaded undefined SIP Profiles
    [Sat, 04 May 2024 15:43:23 GMT] DEBUG Initializing module input
    [Sat, 04 May 2024 15:43:23 GMT] INFO Initializing input Udp
    [Sat, 04 May 2024 15:43:23 GMT] INFO Start listening on udp 0.0.0.0:514
    [Sat, 04 May 2024 15:43:23 GMT] INFO Config loaded.
    ^C[Sat, 04 May 2024 15:46:25 GMT] INFO SIGINT received.
    [Sat, 04 May 2024 15:46:25 GMT] INFO Closing listening udp 0.0.0.0:514
    [Sat, 04 May 2024 15:46:25 GMT] INFO Closing stdout
    [Sat, 04 May 2024 15:46:25 GMT] INFO Closing output to HEP udp to 127.0.0.1:9060
    [Sat, 04 May 2024 15:46:25 GMT] INFO Closing agent
    [Sat, 04 May 2024 15:46:25 GMT] INFO Quitting.

I use the following config file:

input {
udp {
host => 0.0.0.0
port => 514
type => syslog
}
}

filter {
app_audiocodes{
#version => '7.40A.100.114'
version => '7.20A.256.396'
debug => false
autolocal => true
ini => '/tmp/audiocodes.ini'
}
}

output {
stdout{}
if [rcinfo] != 'undefined' {
hep {
host => '127.0.0.1'
port => 9060
hep_id => 2222
}
}
}

The INI file is in the /tmp folder.
Here is my npm and node version:
node -v
v18.13.0
npm -v
9.2.0
myrcin@ZabbixSRV:/opt/pastash$

Also during the installation of the app_audiocodes I got the following warnings:

image

What am I doing wrong? Even though, paStash seems to be running, it does not send any data. Any help is highly appreciated.

@Dletta
Copy link
Collaborator

Dletta commented May 4, 2024

@myrcinos Please execute pastash from /usr/lib/node_modules/@pastash/pastash folder and see if it starts then

@myrcinos
Copy link
Author

myrcinos commented May 4, 2024

I don't have a folder node_modules. However, I don't think this is the cause of the problem because when I start paStash with a config that don't have app_audiocodes, everything is fine.

@lmangani
Copy link
Member

lmangani commented May 5, 2024

@myrcinos pastash plugins are installed as globals, and work best when pastash is too

npm install -g @pastash/pastash @pastash/filter_app_audiocodes

then simply run the installed pastash command with your config recipe

pastash --config_file=/path/to/pastash_audiocodes.conf

@myrcinos
Copy link
Author

myrcinos commented May 5, 2024

@lmangani
Here are the commands I used to install pastash and audiocodes filter:

sdudo npm install --unsafe-perm -g @pastash/pastash
sudo npm install --unsafe-perm -g @pastash/pastash @pastash/filter_app_audiocodes

I am not linux expert but -g means that they both have been installed as globals, right?

Here is the list of npm modules installed as globals. Does it look ok?

myrcin@ZabbixSRV:~$ sudo npm list -g
[sudo] password for myrcin: 
/usr/local/lib
├── @pastash/[email protected]
├── @pastash/[email protected]
├── @pastash/[email protected]
└── [email protected]

Then, when I listed non-global modules I found multiple errors (please see below). How can I fix this. I thought that all dependencies would be installed while installing a module. Isn't that the case?

myrcin@ZabbixSRV:/usr/local/lib/node_modules/@pastash/pastash$ npm list
npm ERR! code ELSPROBLEMS
npm ERR! missing: [email protected], required by @pastash/[email protected]
npm ERR! missing: [email protected], required by @pastash/[email protected]
npm ERR! missing: [email protected], required by @pastash/[email protected]
npm ERR! missing: jshint@^2.9.6, required by @pastash/[email protected]
npm ERR! invalid: [email protected] /usr/local/lib/node_modules/@pastash/pastash/node_modules/lumberjack-protocol
npm ERR! extraneous: [email protected] /usr/local/lib/node_modules/@pastash/pastash/node_modules/nan
npm ERR! invalid: [email protected] /usr/local/lib/node_modules/@pastash/pastash/node_modules/rimrafnpm ERR! missing: [email protected], required by @pastash/[email protected]
npm ERR! missing: [email protected], required by @pastash/[email protected]
npm ERR! missing: which@^1.3.1, required by @pastash/[email protected]
@pastash/[email protected] /usr/local/lib/node_modules/@pastash/pastash
├── UNMET OPTIONAL DEPENDENCY [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── UNMET DEPENDENCY [email protected]
├── UNMET DEPENDENCY [email protected]
├── UNMET DEPENDENCY [email protected]
├── UNMET DEPENDENCY jshint@^2.9.6
├── [email protected]
├── [email protected]
├── [email protected] invalid: "git://github.com/bpaquet/node-lumberjack-protocol.git" from the root project
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── UNMET OPTIONAL DEPENDENCY [email protected]
├── [email protected]
├── [email protected] extraneous
├── [email protected]
├── UNMET OPTIONAL DEPENDENCY [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] invalid: "2.6.x" from the root project
├── [email protected]
├── UNMET DEPENDENCY [email protected]
├── UNMET DEPENDENCY [email protected]
├── UNMET DEPENDENCY which@^1.3.1
├── [email protected]
└── UNMET OPTIONAL DEPENDENCY zmq@*

@Dletta
Copy link
Collaborator

Dletta commented May 6, 2024

@myrcinos

[Sat, 04 May 2024 15:43:23 GMT] DEBUG no local module found filters filter_app_audiocodes Error: Cannot find module 'filters/filter_app_audiocodes'
Require stack:

/usr/local/lib/node_modules/@pastash/pastash/lib/agent.js
/usr/local/lib/node_modules/@pastash/pastash/bin/pastash
at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
at Module._load (node:internal/modules/cjs/loader:885:27)
at Module.require (node:internal/modules/cjs/loader:1105:19)
at require (node:internal/modules/cjs/helpers:103:18)
at LogstashAgent.configure (/usr/local/lib/node_modules/@pastash/pastash/lib/agent.js:133:17)
at LogstashAgent. (/usr/local/lib/node_modules/@pastash/pastash/lib/agent.js:215:10)
at /usr/local/lib/node_modules/@pastash/pastash/node_modules/async/dist/async.js:3113:16
at replenish (/usr/local/lib/node_modules/@pastash/pastash/node_modules/async/dist/async.js:1014:17)
at /usr/local/lib/node_modules/@pastash/pastash/node_modules/async/dist/async.js:1019:9
at eachLimit$1 (/usr/local/lib/node_modules/@pastash/pastash/node_modules/async/dist/async.js:3199:24) {
code: 'MODULE_NOT_FOUND',

This part is a warning and if you look at the line below, the module does get loaded successfully.

Once you start pastash, you should see logs being emitted from the stdout plugin. If you simply see nothing, then you must not be sending to port 514 correctly. (Some systems don't allow these low ports, you can try doing 5514 and seeing if traffic appears then)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants