# Failure running tests for logstash-filter-geoip plugin - logging configuration not loading

**URL:** https://discuss.elastic.co/t/failure-running-tests-for-logstash-filter-geoip-plugin-logging-configuration-not-loading/103949
**Category:** Logstash
**Created:** [October 13, 2017, 7:21pm UTC](https://discuss.elastic.co/t/failure-running-tests-for-logstash-filter-geoip-plugin-logging-configuration-not-loading/103949 "2017-10-13T19:21:39Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![nzjess](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nzjess/32/23044_2.png) [@nzjess](https://discuss.elastic.co/u/nzjess)
#### Post date: [October 13, 2017, 7:21pm UTC](https://discuss.elastic.co/t/failure-running-tests-for-logstash-filter-geoip-plugin-logging-configuration-not-loading/103949/1 "2017-10-13T19:21:39Z")

</div>

I cloned the geoip plugin source from github:

`https://github.com/logstash-plugins/logstash-filter-geoip/commit/921d1cd`

Followed the README to install the pre-reqs:

```
bundle install
bundle exec rake vendor

```

Then ran the tests:

`bundle exec rspec`

But I got the following error:

```
--- jar coordinate com.fasterxml.jackson.core:jackson-databind already loaded with version 2.7.4 - omit version 2.9.1
--- jar coordinate com.fasterxml.jackson.core:jackson-annotations already loaded with version 2.7.0 - omit version 2.9.1
--- jar coordinate com.fasterxml.jackson.module:jackson-module-afterburner already loaded with version 2.7.4 - omit version 2.9.1
--- jar coordinate com.fasterxml.jackson.core:jackson-core already loaded with version 2.7.4 - omit version 2.9.1
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.

An error occurred while loading ./spec/filters/geoip_spec.rb.
Failure/Error: # encoding: utf-8

ArgumentError:
  invalid level[OFF] for logger[]
# ./spec/filters/geoip_spec.rb:1:in `<main>'
# ./spec/filters/geoip_spec.rb:2:in `(root)'
# ------------------
# --- Caused by: ---
# NoMethodError:
# undefined method `getConfiguration' for nil:NilClass
# ./spec/filters/geoip_spec.rb:1:in `<main>'
No examples found.

Finished in 0.00555 seconds (files took 2.74 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples

```

A debugged a bit and what's happening is that the code is reaching line 97 of logger.rb:

`jruby-9.1.13.0/lib/ruby/gems/shared/gems/logstash-core-5.5.1.snapshot1-java/lib/logstash/logging/logger.rb:97`

Which looks like this:

```
# Clone of org.apache.logging.log4j.core.config.Configurator.setLevel(), but using initialized @@logging_context
      def self.set_level(_level, path)
        configuration = @@logging_context.getConfiguration()
        level = Level.valueOf(_level)
        if path.nil? || path.strip.empty?

```

And `@@logging_context` is nil at this point.

It's like self.initialize(config\_location) in that file is never called for some reason?

```
def self.initialize(config_location)
        @@config_mutex.synchronize do
          if @@logging_context.nil?

```

Not sure if this is relevant, but here's the output of `bundle exec rake vendor`:

```
Downloading https://s3.amazonaws.com/download.elasticsearch.org/logstash/maxmind/GeoLite2-ASN.mmdb
Downloading https://s3.amazonaws.com/download.elasticsearch.org/logstash/maxmind/LICENSE.txt
-------------------> Wrote /Users/jesse/Devel/ubercraft/source/logstash-filter-geoip/gradle.properties
logstashCoreGemPath=/Users/jesse/bin/jruby-9.1.13.0/lib/ruby/gems/shared/gems/logstash-core-5.5.1.snapshot1-java
logstashCoreEventGemPath=Could not find gem 'logstash-core-event'.
Starting a Gradle Daemon (subsequent builds will be faster)
:generateGemJarRequiresFile
:compileJava
:processResources UP-TO-DATE
:classes
:jar
:vendor

```

Can anyone tell me what I'm doing wrong?

Thanks,  
Jesse.

---

<div class="post-metadata">

### Author: ![Shrawan\_Bhagwat](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@Shrawan\_Bhagwat](https://discuss.elastic.co/u/Shrawan_Bhagwat)
#### Post date: [October 16, 2017, 9:41am UTC](https://discuss.elastic.co/t/failure-running-tests-for-logstash-filter-geoip-plugin-logging-configuration-not-loading/103949/2 "2017-10-16T09:41:12Z")

</div>

Hi,

Which version of Logstash you are using? and also can you give more clarification on your ques as geoip plugin is inbuilt with logstash.

---

<div class="post-metadata">

### Author: ![nzjess](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nzjess/32/23044_2.png) [@nzjess](https://discuss.elastic.co/u/nzjess)
#### Post date: [October 16, 2017, 12:32pm UTC](https://discuss.elastic.co/t/failure-running-tests-for-logstash-filter-geoip-plugin-logging-configuration-not-loading/103949/3 "2017-10-16T12:32:16Z")

</div>

Hi,

All I'm trying to do is checkout the code for the logstash geoip filter, build it locally, then run the tests. As I mentioned this is the commit I'm trying to build/test:

> <https://github.com/logstash-plugins/logstash-filter-geoip/commit/921d1cd>

The reason is I'd like to understand the code and then hopefully use it as a good example for how to implement my own filters.

But I can't even get that far. Any help with this appreciated.

Thanks,  
Jesse.

---

<div class="post-metadata">

### Author: ![NQKdev](https://avatars.discourse-cdn.com/v4/letter/n/b487fb/32.png) [@NQKdev](https://discuss.elastic.co/u/NQKdev)
#### Post date: [October 17, 2017, 2:20pm UTC](https://discuss.elastic.co/t/failure-running-tests-for-logstash-filter-geoip-plugin-logging-configuration-not-loading/103949/4 "2017-10-17T14:20:11Z")

</div>

Hi,

I have the same problem doing the test.

Here is the pipeline of a working commit, it passed last week but when I ran it again today, it gave the same error as what you have. I supposed this has something to do with `bundle install`.

> **[test (#10057) · Jobs · Integration Plugins / Logstash](https://git.bitsensor.io/plugins/logstash/-/jobs/10057)**
>
> Logstash Configurations - https://plugins.bitsensor.io/logstash

---

<div class="post-metadata">

### Author: ![nzjess](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nzjess/32/23044_2.png) [@nzjess](https://discuss.elastic.co/u/nzjess)
#### Post date: [October 18, 2017, 9:35am UTC](https://discuss.elastic.co/t/failure-running-tests-for-logstash-filter-geoip-plugin-logging-configuration-not-loading/103949/5 "2017-10-18T09:35:09Z")

</div>

Thanks. So this issue is caused by something external to the repo?

Here's a copy of my shell, going through the sequence of cloning, setting up and running the tests (as documented in the [README.md](http://README.md) file):

> <https://gist.github.com/nzjess/d815f03240f739df2a72112dcac7d28c>

Does anyone know how to get this working?

Cheers,  
Jesse.

---

<div class="post-metadata">

### Author: ![nzjess](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nzjess/32/23044_2.png) [@nzjess](https://discuss.elastic.co/u/nzjess)
#### Post date: [October 19, 2017, 7:47am UTC](https://discuss.elastic.co/t/failure-running-tests-for-logstash-filter-geoip-plugin-logging-configuration-not-loading/103949/6 "2017-10-19T07:47:18Z")

</div>

I've just tried the same thing with a different plugin:

> **[logstash-plugins/logstash-filter-de\_dot](https://github.com/logstash-plugins/logstash-filter-de_dot/tree/master)**
>
> logstash-filter-de\_dot - Rename fields with dots in the field name for Elasticsearch 2.0 compatibility

Checked out the source, installed deps, build and test, and it has the same problem.

So is this some problem with my dev environment? I'm just doing this on my mac, just local, not using Docker or any VM. With JRuby version 9.1.13.0.

---

<div class="post-metadata">

### Author: ![kompa3](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kompa3/32/23338_2.png) [@kompa3](https://discuss.elastic.co/u/kompa3)
#### Post date: [October 24, 2017, 8:32am UTC](https://discuss.elastic.co/t/failure-running-tests-for-logstash-filter-geoip-plugin-logging-configuration-not-loading/103949/7 "2017-10-24T08:32:48Z")

</div>

I got around this problem by dowgrading to logstash-devutils version 1.3.4. Apparently the latest version 1.3.5 has some bugs that cause this.

---

<div class="post-metadata">

### Author: ![jweite](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@jweite](https://discuss.elastic.co/u/jweite)
#### Post date: [October 24, 2017, 5:01pm UTC](https://discuss.elastic.co/t/failure-running-tests-for-logstash-filter-geoip-plugin-logging-configuration-not-loading/103949/8 "2017-10-24T17:01:08Z")

</div>

Thanks kompa3. Just downgraded and locked-in to 1.3.4. Will want to open up to newer (working) versions when available.

---

<div class="post-metadata">

### Author: ![davidecavestro](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidecavestro/32/23461_2.png) [@davidecavestro](https://discuss.elastic.co/u/davidecavestro)
#### Post date: [October 26, 2017, 12:49pm UTC](https://discuss.elastic.co/t/failure-running-tests-for-logstash-filter-geoip-plugin-logging-configuration-not-loading/103949/9 "2017-10-26T12:49:56Z")

</div>

I'm experiencing a similar problem with travis check jobs for a small patch to logstash-filter-elasticsearch: [https://github.com/logstash-plugins/logstash-filter-elasticsearch/pull/81](https://github.com/logstash-plugins/logstash-filter-elasticsearch/pull/81)

But I simply replaced a word in an asciidoc file...

---

<div class="post-metadata">

### Author: ![NQKdev](https://avatars.discourse-cdn.com/v4/letter/n/b487fb/32.png) [@NQKdev](https://discuss.elastic.co/u/NQKdev)
#### Post date: [October 27, 2017, 8:30am UTC](https://discuss.elastic.co/t/failure-running-tests-for-logstash-filter-geoip-plugin-logging-configuration-not-loading/103949/10 "2017-10-27T08:30:27Z")

</div>

I solved the issue by using local logstash-core and specify the path to it in Gemfile.

[https://git.bitsensor.io/plugins/logstash/blob/master/Gemfile](https://git.bitsensor.io/plugins/logstash/blob/master/Gemfile)

---

<div class="post-metadata">

### Author: ![nzjess](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nzjess/32/23044_2.png) [@nzjess](https://discuss.elastic.co/u/nzjess)
#### Post date: [November 2, 2017, 9:28am UTC](https://discuss.elastic.co/t/failure-running-tests-for-logstash-filter-geoip-plugin-logging-configuration-not-loading/103949/11 "2017-11-02T09:28:31Z")

</div>

Thanks @jweite, I tried this suggestion and the tests now run!

```
jesse ~/source/logstash-filter-geoip (master)
> git diff
diff --git a/logstash-filter-geoip.gemspec b/logstash-filter-geoip.gemspec
index de8a1ad..b994928 100644
--- a/logstash-filter-geoip.gemspec
+++ b/logstash-filter-geoip.gemspec
@@ -22,6 +22,6 @@ Gem::Specification.new do |s|

   # Gem dependencies
   s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
- s.add_development_dependency 'logstash-devutils'
+ s.add_development_dependency 'logstash-devutils', "= 1.3.4"
   s.add_development_dependency 'benchmark-ips'
 end 

```

Does anyone know why the all the test don't pass now? This is the commit I'm running:

`63cf67a by Jake Landis - Travis - add 6.0 build, remove default JRuby 1.7 build, bump RVM versions`

And this is the test output:

```
jesse ~/source/logstash-filter-geoip (master)
> bundle exec rspec
--- jar coordinate com.fasterxml.jackson.core:jackson-databind already loaded with version 2.7.4 - omit version 2.9.1
--- jar coordinate com.fasterxml.jackson.core:jackson-annotations already loaded with version 2.7.0 - omit version 2.9.1
--- jar coordinate com.fasterxml.jackson.module:jackson-module-afterburner already loaded with version 2.7.4 - omit version 2.9.1
--- jar coordinate com.fasterxml.jackson.core:jackson-core already loaded with version 2.7.4 - omit version 2.9.1
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
Sending Logstash's logs to which is now configured via log4j2.properties
Run options: exclude {:redis=>true, :socket=>true, :performance=>true, :couchdb=>true, :elasticsearch=>true, :elasticsearch_secure=>true, :export_cypher=>true, :integration=>true, :windows=>true}

Randomized with seed 14034
...............F......

Failures:

  1) LogStash::Filters::GeoIP source is derived from target when source field 'ip' is a subfield of 'target' should set other subfields of 'target' properly
     Failure/Error: expect(event.get("[target][city_name]")).to eq("Worcester")

       expected: "Worcester"
            got: "Salem"

       (compared using ==)
     # ./spec/filters/geoip_spec.rb:96:in `block in (root)'

Finished in 0.94125 seconds (files took 2.86 seconds to load)
22 examples, 1 failure

Failed examples:

rspec ./spec/filters/geoip_spec.rb:94 # LogStash::Filters::GeoIP source is derived from target when source field 'ip' is a subfield of 'target' should set other subfields of 'target' properly

Randomized with seed 14034

```

Thanks everyone for all the help!

Jesse.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [November 30, 2017, 9:28am UTC](https://discuss.elastic.co/t/failure-running-tests-for-logstash-filter-geoip-plugin-logging-configuration-not-loading/103949/12 "2017-11-30T09:28:34Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
