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

Unable to query data from elasticsearch #99

Closed
kinzhong opened this issue Aug 11, 2021 · 4 comments
Closed

Unable to query data from elasticsearch #99

kinzhong opened this issue Aug 11, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@kinzhong
Copy link
Contributor

Describe the bug
Hi, I am trying to follow the tutorial from the documentation hub using an ELK stack. However, I am getting a KestrelSyntaxError when querying. I tried it with Python 3.6 and 3.9; both have the same error results.

Details of the bug

  • What is the hunt flow/script you are executing?
    Hunt flow from the tutorial.
  • What is the command that failed?
var = GET process FROM stixshifter://host101
  • What is the error message?
[ERROR] KestrelSyntaxError: invalid token "" at line 1 column 24. rewrite the failed statement.

To Reproduce
Steps to reproduce the behavior:

  1. Setup Symon & Elasticsearch
  2. Create API key on Elasticsearch for access
  3. Test Elasticsearch access using API key
  4. Configure environment variables
$ export STIXSHIFTER_HOST101_CONNECTOR=elastic_ecs
$ export STIXSHIFTER_HOST101_CONNECTION='{"host":"REDACTED.elastic-cloud.com", "port":9243, "indices":"winlogbeat-7.14.0-2021.08.04-000001"}'
$ export STIXSHIFTER_HOST101_CONFIG='{"auth":{"id":"REDACTED", "api_key":"REDACTED"}}'
  1. Test using stix-shifter:
$ stix-shifter transmit elastic_ecs '{"host":"REDACTED.elastic-cloud.com", "port":9243, "indices":"winlogbeat-7.14.0-2021.08.04-000001"}' '{"auth":{"id":"REDACTED", "api_key":"REDACTED"}}' ping

{

    "success": true,

    "data": "{\n  \"cluster_name\" : \"66a63ad60eae4e2b9fb38f524b8defcc\",\n  \"status\" : \"green\",\n  \"timed_out\" : false,\n  \"number_of_nodes\" : 3,\n  \"number_of_data_nodes\" : 2,\n  \"active_primary_shards\" : 86,\n  \"active_shards\" : 172,\n  \"relocating_shards\" : 0,\n  \"initializing_shards\" : 0,\n  \"unassigned_shards\" : 0,\n  \"delayed_unassigned_shards\" : 0,\n  \"number_of_pending_tasks\" : 0,\n  \"number_of_in_flight_fetch\" : 0,\n  \"task_max_waiting_in_queue_millis\" : 0,\n  \"active_shards_percent_as_number\" : 100.0\n}\n"

}
  1. Run jupyter notebook with command
var = GET process FROM stixshifter://host101
[ERROR] KestrelSyntaxError: invalid token "" at line 1 column 24. rewrite the failed statement.

Expected behavior
Results from query

Environment (please complete the following information):

  • OS: Ubuntu 20.04
  • Python version: Python 3.9.5, Python 3.6.9
  • Python install environment: Python virtual environment
  • STIX-Shifter version: 3.5.0
@kinzhong kinzhong added the bug Something isn't working label Aug 11, 2021
@subbyte
Copy link
Member

subbyte commented Aug 12, 2021

You may want to try with a WHERE clause to describe the processes you'd like to get. And for the first GET to a data source, we strongly recommend to add START/STOP. More information is in the syntax doc: https://kestrel.readthedocs.io/en/latest/language.html#get

@pcoccoli
Copy link
Collaborator

The WHERE clause is required. That's the part that gets translated to an elasticsearch query. A better error message would be nice.

@subbyte
Copy link
Member

subbyte commented Aug 14, 2021

better syntax error message support in ced4da7 and released into v1.0.13

@kinzhong
Copy link
Contributor Author

Thank you for the clarification! It works on my end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants