fluentd cannot find custom filter plugin on Windows with calyptia-fluentd - fluentd

On this system I have calyptia-fluentd, and I'm trying to develop a custom filter plugin.
To start, I've created a gem with some initial code, and I have installed this gem, and have created a config file with uses the plugin.
However, starting calyptia-fluentd on the command line (the environment is the one provided by the installer, not the generic Windows command prompt) gives me this:
C:\opt\calyptia-fluentd>calyptia-fluentd -vv
2022-08-11 16:24:23 +0200 [info]: fluent/log.rb:330:info: parsing config file is succeeded path="C:\\opt\\calyptia-fluentd\\bin\\\\..\\etc\\calyptia-fluentd\\calyptia-fluentd.conf"
2022-08-11 16:24:23 +0200 [info]: fluent/log.rb:330:info: gem 'fluentd' version '1.15.0'
2022-08-11 16:24:23 +0200 [info]: fluent/log.rb:330:info: gem 'fluent-plugin-calyptia-monitoring' version '0.1.3'
...
2022-08-11 16:24:23 +0200 [info]: fluent/log.rb:330:info: gem 'fluent-plugin-custom' version '0.0.3'
...
2022-08-11 16:24:23 +0200 [info]: fluent/log.rb:330:info: gem 'fluent-plugin-windows-eventlog' version '0.8.1'
2022-08-11 16:24:23 +0200 [error]: fluent/log.rb:372:error: config error file="C:\\opt\\calyptia-fluentd\\bin\\\\..\\etc\\calyptia-fluentd\\calyptia-fluentd.conf" error_class=Fluent::NotFoundPluginError error="Unknown filter plugin 'filter_custom'. Run 'gem search -rd fluent-plugin' to find plugins"
Note that it says it's loaded the fluent-plugin-custom gem, but then it bombs out with the "Unknown plugin" error.
The plugin code, placed in filter_custom.rb is:
module Fluent::Plugin
class CustomFilter < Filter
Fluent::Plugin.register_filter('custom', self)
# ...
def filter(tag, time, record)
record
end
# ...
end
end
I've also tried placing it in /etc/calyptia-fluentd/plugin on a Linux system, with the same problem.
How do I get Fluentd to use the new plugin?

Maybe it will save others time: the plugin code was correct, the gem was correctly installed, but what didn't work was the config file. It referenced filter_custom when it should have referenced just custom.

Related

Bad wkhtmltopdf's path: bundler: command not found: which

I'm using the wkhtmltopdf gem in Rails on Windows but it does not work. I get this error:
"Bad wkhtmltopdf's path: bundler: command not found: which".
It works with exe but i don't want use exe_path, i just want to use the gem.
This is my wkhtmltopdf config file:
# WickedPDF Global Configuration
#
# Use this to set up shared configuration options for your entire application.
# Any of the configuration options shown here can also be applied to single
# models by passing arguments to the `render :pdf` call.
#
# To learn more, check out the README:
#
# https://github.com/mileszs/wicked_pdf/blob/master/README.md
WickedPdf.config = {
# Path to the wkhtmltopdf executable: This usually isn't needed if using
# one of the wkhtmltopdf-binary family of gems.
# exe_path: 'C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe'
}
I'm also using the gem 'wicked_pdf' gem 'wkhtmltopdf-binary'
It looks like the wkhtmltopdf gem does not support the Windows operating system. I found this in the source code:
suffix = case RbConfig::CONFIG['host_os']
when /linux/
(RbConfig::CONFIG['host_cpu'] == 'x86_64') ? 'linux_amd64' : 'linux_x86'
when /darwin/
'darwin_x86'
else
raise "Invalid platform. Must be running on linux or intel-based Mac OS."
end
The other hint is the fact you received: command not found: which. which is a Unix command to identify the location of executables, not available for Windows. Sorry
this worked for me
exe_path: 'C://Program Files/wkhtmltopdf/bin/wkhtmltopdf.exe'

Running rake test on a Rails app that uses minitest only runs a single test. Is ruby deprecation a cause?

I'm currently trying to run tests in a Ruby on Rails app hosted with Puma instead of WeBrick. This is on Windows. Below is the error I get.
C:\Users\Ka\Desktop\code\developmentdatabase>bundle exec rake test
ansi: 'gem install win32console' to use color on Windows
RubyDep: WARNING: Your Ruby is outdated/buggy. (To disable warnings, set RUBY_DEP_GEM_SILENCE_WARNINGS=1)
RubyDep: WARNING: Your Ruby is: 2.2.4 (buggy). Recommendation: install 2.2.5 or 2.3.1.
Started with run options "-n=/^(EditTest\\#test_requires_a_log_message)$/" --seed 3480
0/0: [===================================] 100% Time: 00:00:00, Time: 00:00:00
FAIL["test_requires_a_log_message", EditTest, 0.7240425939962734]
test_requires_a_log_message#EditTest (0.72s)
Expected true to be nil or false
test/models/edit_test.rb:45:in `block in <class:EditTest>'
0/0: [===================================] 100% Time: 00:00:00, Time: 00:00:00
WARNING: Your progress bar is currently at 0 out of 0 and cannot be incremented. In v2.0.0 this will become a ProgressBar::InvalidProgressError.
0/0: [===================================] 100% Time: 00:00:00, Time: 00:00:00
Finished in 0.72932s
1 tests, 1 assertions, 1 failures, 0 errors, 0 skips
20:01:43 - INFO - Run 'gem install win32console' to use color on Windows
I am unable to make my Rails app use the ruby 2.3.1, which I detail extensively in this thread which is still unanswered. But the gist is that ruby -v shows 2.3.1, but Rails won't use it.
Here's the Gemfile for the test environment:
group :test do
gem 'minitest-rails' # Test library
gem 'minitest-rails-capybara' # Integration tests
gem 'minitest-reporters' # For progress bar, etc.
gem 'minitest-fail-fast' # End testing on first failure
gem 'minitest-focus' # One test at a time
gem 'codeclimate-test-reporter', require: nil
gem 'launchy'
gem 'rake' # Specified for Travis CI
gem 'webmock' # Disable network connections
end

rspec spec gives "Failed to load /home/searching/.gemrc because it doesn't contain valid YAML /"

Failed to load /home/searching/.gemrc because it doesn't contain valid YAML
when i excute this command rspec spec/
the above error will appear and not able to do the test case using spec
.gemrc is not Gemfile.
.gemrc are YAML files with the following YAML keys:
:sources: A YAML array of remote gem repositories to install gems from
:verbose: Verbosity of the gem command. false, true, and :really are the
levels
:update_sources: Enable/disable automatic updating of repository metadata
:backtrace: Print backtrace when RubyGems encounters an error
:gempath: The paths in which to look for gems
:disable_default_gem_server: Force specification of gem server host on push
<gem_command>: A string containing arguments for the specified gem command
Example:
:verbose: false
install: --no-wrappers
update: --no-wrappers
:disable_default_gem_server: true
It is described in details here: http://guides.rubygems.org/command-reference/

RailInstaller Rails server todo fails because of sqlite3

I'm trying to make the Rails server work, using RailsInstaller, which I downloaded at:
http://railsinstaller.org/
I executed all without any problem, and the server starts properly at:
C:\Sites\todo
But at the very moment I try to open the page in my browser (http://localhost:3000/)
I getting an Action Controller:Exception Caught
LoadError
cannot load such file -- sqlite3
Rails.root: C:/Sites/todo Application Trace | Framework Trace | Full
Trace
This error occurred while loading the following files: sqlite3
Request
Parameters: None
> Show session dump
> Show env dump
Response
Headers: None
And the Server log says this:
Started GET "/" for 127.0.0.1 at 2012-10-22 18:08:48 +0200
LoadError (cannot load such file -- sqlite3):
Rendered
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.0.9/lib/action_dispatch/middleware/templates/rescues/_trace.erb (0.0 ms)
Rendered
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.0.9/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (31.2 ms)
Rendered
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.0.9/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (62.5 ms)
I already did the gem install sqlite3 but I'm still getting this message.
Do you have any clue about what is going on?
Check your Gemfile and try reinstalling with version number
gem uninstall sqlite3
gem install sqlite3 -v=1.3.6
Make sure you have:
gem 'sqlite3', '1.3.6'
in your Gemfile
You may also need the windows binary of sqlite3 installed I'm not sure

Javascript manifest file "application.js" is not processed

I am on a Macbook Pro and I created a new Rails 3.2 app, but the assets pipeline does not work. Here is what I did:
$ rails version
Rails 3.2.5
$ rails new test_assets
$ cd test_assets
$ rails server
The server is started OK, but if I visit http://0.0.0.0:3000/assets/application.js, it turns out the manifest file is not processed at all, it shows:
//... some comments ...
//= require jquery
//= require jquery_ujs
//= require_tree .
;
I tried to do the exactly the same steps on my other Macbook Pro. It works well. Visiting http://0.0.0.0:3000/assets/application.js on that machine shows a compiled javascript file with all the contents.
I have read http://railscasts.com/episodes/279-understanding-the-asset-pipeline and http://guides.rubyonrails.org/asset_pipeline.html, and I searched for hours on the web but with no clue.
Your help is really appreciated!
I had the same issue!
Downgrading Ruby from 2.0.0 to 1.9.3 fixed the issue
Suggestions: install node.js or uncomment gem 'therubyracer', :platforms => :ruby in your Gemfile
I followed the same steps and my log file looks like this... What does yours look like if you start the server and request /assets/application.js? As you can see, I'm on 3.2.6, and it compiled my application.js
=> Booting WEBrick
=> Rails 3.2.6 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-07-19 22:50:02] INFO WEBrick 1.3.1
[2012-07-19 22:50:02] INFO ruby 1.9.3 (2012-02-16) [x86_64-darwin11.3.0]
[2012-07-19 22:50:02] INFO WEBrick::HTTPServer#start: pid=21393 port=3000
Started GET "/assets/rails.png" for 127.0.0.1 at 2012-07-19 22:50:13 -0500
Connecting to database specified by database.yml
Served asset /rails.png - 200 OK (9ms)
Started GET "/assets/application.js" for 127.0.0.1 at 2012-07-19 22:50:23 -0500
Compiled jquery.js (2ms) (pid 21393)
Compiled jquery_ujs.js (0ms) (pid 21393)
Compiled application.js (26ms) (pid 21393)
Served asset /application.js - 200 OK (74ms)
[2012-07-19 22:50:24] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
Faced exactly the same case.
I've found that I use ruby like v2.0.0rc or something like that, and all works perfect if I downgrade it to 1.9.3p194 (both are under the Rbenv).
Though you can use helper in a view, like <%= javascript_include_tag "jquery", "jquery_ujs" %>, it also helped me even with ruby2.0.0.
I have run into the same issue today and I was ready to downgrade Ruby to 1.9.3 from 2.0 to solve the issue of application.js not compiling. The issue happened on the production server, which has Ruby 2.0 installed (and Rails 3.2.8). On the development machine(Ruby 1.9.3 and Rails 3.2.8) application.js compiled just fine.
At last resort, I upgraded the production server from Rails 3.2.8 to 3.2.14; remove Gemfile.lock, and ran bundle install. Then I recompiled the assets, and voila application.js compiled the assets.
I thought of sharing this with Stackoverflow audience, maybe this will solve someone else's issues.
The first officially supported version of rails 3.2 with ruby 2.0 is 3.2.13.So upgrade your rails version to rails 3.2.13 will solve the problem.
Step for upgrading:
1)Change rails version in Gemfile to gem 'rails', '3.2.22'.
2)bundle update rails
On development the assets are not precompiled. If you want to see them, you should run bundle exec rake assets:precompile.
open enviornment/development.rb and set config.assets.debug = false . That's it

Resources