ELK stack on windows server with MSSQL db

Hi, dear community.
I am new in ELK, I have task to create Kibana dashboards for data visualization on Win server(aws) and I have to use MSSQL as data source.
I created file db.conf with content below:
input {
jdbc {
jdbc_connection_string => "jdbc:sqlserver://alt.database.windows.net:1433;databaseName=***;user=***;password=***;"
jdbc_driver_library => "C:\elk\logstash-5.4.2\lib\sqljdbc41.jar"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
statement => "SELECT * from rep_mainTable"
}
}
output {
stdout { codec => json_lines }
}

then I use command:
C:\elk\logstash-5.4.2\bin>logstash.bat -f ..\config\db.conf

But unfortunately I see error message:
Sending Logstash's logs to C:/elk/logstash-5.4.2/logs which is now configured via log4j2.properties
[2017-06-27T15:28:48,270][FATAL][logstash.runner ] An unexpected error occurred!
{:error=>#<ArgumentError: Setting "" hasn't been registered>,
:backtrace=>["C:/elk/logstash-5.4.2/logstash-core/lib/logstash/settings.rb:29
:in get_setting'", "C:/elk/logstash-5.4.2/logstash-core/lib/logstash/settings.rb:61 :inset_value'", "C:/elk/logstash-5.4.2/logstash-core/lib/logstash/settings.rb:80
:in merge'", "org/jruby/RubyHash.java:1342 :ineach'", "C:/elk/logstash-5.4.2/logstash-core/lib/logstash/settings.rb:80
:in merge'", "C:/elk/logstash-5.4.2/logstash-core/lib/logstash/settings.rb:129 :invalidate_all'", "C:/elk/logstash-5.4.2/logstash-core/lib/logstash/runner.rb:217
:in execute'", "C:/elk/logstash-5.4.2/vendor/bundle/jruby/1.9/gems/clamp-0.6.5/lib/clamp/command.rb:67 :inrun'", "C:/elk/logstash-5.4.2/logstash-core/lib/logstash/runner.rb:185
:in run'", "C:/elk/logstash-5.4.2/vendor/bundle/jruby/1.9/gems/clamp-0.6.5/lib/clamp/command.rb:132 :inrun'", "C:\elk\logstash-5.4.2\lib\bootstrap\environment.rb:71:in `(root)'"]}

Can you please help to fix it.

The error message is incomplete. Please paste it again but format it as preformatted text (use the </> toolbar button).

oh, I am sorry

Sending Logstash's logs to C:/elk/logstash-5.4.2/logs which is now configured via log4j2.properties
[2017-06-27T15:28:48,270][FATAL][logstash.runner          ] An unexpected error occurred! {:error=>#<ArgumentError: Setting "" hasn't been registered>, :backtrace=>["C:/elk/logstash-5.4.2/logstash-core/lib/logstash/settings.rb:29:in `get_setting'", "C:/elk/logstash-5.4.2/logstash-core/lib/logstash/settings.rb:61:in `set_value'", "C:/elk/logstash-5.4.2/logstash-core/lib/logstash/settings.rb:80:in `merge'", "org/jruby/RubyHash.java:1342:in `each'", "C:/elk/logstash-5.4.2/logstash-core/lib/logstash/settings.rb:80:in `merge'", "C:/elk/logstash-5.4.2/logstash-core/lib/logstash/settings.rb:129:in `validate_all'", "C:/elk/logstash-5.4.2/logstash-core/lib/logstash/runner.rb:217:in `execute'", "C:/elk/logstash-5.4.2/vendor/bundle/jruby/1.9/gems/clamp-0.6.5/lib/clamp/command.rb:67:in `run'", "C:/elk/logstash-5.4.2/logstash-core/lib/logstash/runner.rb:185:in `run'", "C:/elk/logstash-5.4.2/vendor/bundle/jruby/1.9/gems/clamp-0.6.5/lib/clamp/command.rb:132:in `run'", "C:\\elk\\logstash-5.4.2\\lib\\bootstrap\\environment.rb:71:in `(root)'"]}

Have you modified config/logstash.yml? If yes, please post the contents formatted as preformatted text using the </> toolbar button.

Yes. There is logstash.yml:

input {     
jdbc {
jdbc_connection_string => "jdbc:sqlserver://zzzz.windows.net:1433;databaseName=zzzz;user=zzzz;password=zzzz;"
jdbc_driver_library => "C:\elk\logstash-5.4.2\lib\sqljdbc41.jar"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
statement => "SELECT * from rep_mainTable"
}
}
output {
stdout { codec => json_lines }
}

Is that really what your config/logstash.yml looks like? Note that I did not ask for db.conf.

Yes, I put the same content in logstash.yml.
I can try to return default logstash.yml and run again...

This is logstash.yml now:

   # Settings file in YAML
    #
    # Settings can be specified either in hierarchical form, e.g.:
    #
    #   pipeline:
    #     batch:
    #       size: 125
    #       delay: 5
    #
    # Or as flat keys:
    #
    #   pipeline.batch.size: 125
    #   pipeline.batch.delay: 5
    #
    # ------------  Node identity ------------
    #
    # Use a descriptive name for the node:
    #
    # node.name: test
    #
    # If omitted the node name will default to the machine's host name
    #
    # ------------ Data path ------------------
    #
    # Which directory should be used by logstash and its plugins
    # for any persistent needs. Defaults to LOGSTASH_HOME/data
    #
    # path.data:
    #
    # ------------ Pipeline Settings --------------
    #
    # Set the number of workers that will, in parallel, execute the filters+outputs
    # stage of the pipeline.
    #
    # This defaults to the number of the host's CPU cores.
    #
    # pipeline.workers: 2
    #
    # How many workers should be used per output plugin instance
    #
    # pipeline.output.workers: 1
    #
    # How many events to retrieve from inputs before sending to filters+workers
    #
    # pipeline.batch.size: 125
    #
    # How long to wait before dispatching an undersized batch to filters+workers
    # Value is in milliseconds.
    #
    # pipeline.batch.delay: 5
    #
    # Force Logstash to exit during shutdown even if there are still inflight
    # events in memory. By default, logstash will refuse to quit until all
    # received events have been pushed to the outputs.
    #
    # WARNING: enabling this can lead to data loss during shutdown
    #
    # pipeline.unsafe_shutdown: false
    #
    # ------------ Pipeline Configuration Settings --------------
    #
    # Where to fetch the pipeline configuration for the main pipeline
    #
    # path.config:
    #
    # Pipeline configuration string for the main pipeline
    #
    # config.string:
    #
    # At startup, test if the configuration is valid and exit (dry run)
    #
    # config.test_and_exit: false
    #
    # Periodically check if the configuration has changed and reload the pipeline
    # This can also be triggered manually through the SIGHUP signal
    #
    # config.reload.automatic: false
    #
    # How often to check if the pipeline configuration has changed (in seconds)
    #
    # config.reload.interval: 3
    #
    # Show fully compiled configuration as debug log message
    # NOTE: --log.level must be 'debug'
    #
    # config.debug: false
    #
    # ------------ Queuing Settings --------------
    #
    # Internal queuing model, "memory" for legacy in-memory based queuing and
    # "persisted" for disk-based acked queueing. Defaults is memory
    #
    # queue.type: memory
    #
    # If using queue.type: persisted, the directory path where the data files will be stored.
    # Default is path.data/queue
    #
    # path.queue:
    #
    # If using queue.type: persisted, the page data files size. The queue data consists of
    # append-only data files separated into pages. Default is 250mb
    #
    # queue.page_capacity: 250mb
    #
    # If using queue.type: persisted, the maximum number of unread events in the queue.
    # Default is 0 (unlimited)
    #
    # queue.max_events: 0
    #
    # If using queue.type: persisted, the total capacity of the queue in number of bytes.
    # If you would like more unacked events to be buffered in Logstash, you can increase the
    # capacity using this setting. Please make sure your disk drive has capacity greater than
    # the size specified here. If both max_bytes and max_events are specified, Logstash will pick
    # whichever criteria is reached first
    # Default is 1024mb or 1gb
    #
    # queue.max_bytes: 1024mb
    #
    # If using queue.type: persisted, the maximum number of acked events before forcing a checkpoint
    # Default is 1024, 0 for unlimited
    #
    # queue.checkpoint.acks: 1024
    #
    # If using queue.type: persisted, the maximum number of written events before forcing a checkpoint
    # Default is 1024, 0 for unlimited
    #
    # queue.checkpoint.writes: 1024
    #
    # If using queue.type: persisted, the interval in milliseconds when a checkpoint is forced on the head page
    # Default is 1000, 0 for no periodic checkpoint.
    #
    # queue.checkpoint.interval: 1000
    #
    # ------------ Metrics Settings --------------
    #
    # Bind address for the metrics REST endpoint
    #
    # http.host: "127.0.0.1"
    #
    # Bind port for the metrics REST endpoint, this option also accept a range
    # (9600-9700) and logstash will pick up the first available ports.
    #
    # http.port: 9600-9700
    #
    # ------------ Debugging Settings --------------
    #
    # Options for log.level:
    #   * fatal
    #   * error
    #   * warn
    #   * info (default)
    #   * debug
    #   * trace
    #
    # log.level: info
    # path.logs:
    #
    # ------------ Other Settings --------------
    #
    # Where to find custom plugins
    # path.plugins: []

And error message is new:

Sending Logstash's logs to C:/elk/logstash-5.4.2/logs which is now configured via log4j2.properties
[2017-06-27T18:53:50,949][INFO ][logstash.setting.writabledirectory] Creating directory {:setting=>"path.queue", :path=>"C:/elk/logstash-5.4.2/data/queue"}
[2017-06-27T18:53:51,014][INFO ][logstash.agent           ] No persistent UUID file found. Generating new UUID {:uuid=>"2f2ae073-ce5b-4e3a-89ce-c8b39e4ec059", :path=>"C:/elk/logstash-5.4.2/data/uuid"}
[2017-06-27T18:53:51,333][ERROR][logstash.inputs.jdbc     ] Missing a required setting for the jdbc input plugin:

  input {
    jdbc {
      jdbc_user => # SETTING MISSING
      ...
    }
  }
[2017-06-27T18:53:51,374][ERROR][logstash.agent           ] Cannot create pipeline {:reason=>"Something is wrong with your configuration."}

I fixed config\db.conf like this:

   input {     
    jdbc {
    jdbc_connection_string => "jdbc:sqlserver://alt.database.windows.net:1433;databaseName=zzz"
    jdbc_user => "zzz"
    jdbc_password => "zzz"
    jdbc_driver_library => "C:\elk\logstash-5.4.2\lib\sqljdbc41.jar"
    jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
    statement => "SELECT * from rep_mainTable"
    }
    }
    output {
    stdout { codec => json_lines }
    }

and it is works! Thank you very much!!!

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