LogStack - Help with elasticsearch as data source


(Paulo Coutinho) #1

Hi people,

Im trying making a datasource using elasticsearch with my tool LogStack (https://github.com/prsolucoes/logstack/). But after try a lot i have one method that i dont know how to do solve the problem.

This is the file:

Method:
LogList

This method need make a simple search wih some conditions:
1 - all logs need be retrieved by a token
2 - if message is empty, the search need be greater than date parameter
3 - if message is not empty, the search need contains the message (like a like sql command)

I try made it in my current class above, but not success :frowning:

Can anyone help me with it? Thanks.


(Magnus Bäck) #2

What's the problem, specifically? Is the query returning an error? Since you're throwing away the query results I figure the problem isn't that you don't get the result you expected.


(Paulo Coutinho) #3

It dont return results. I dont know if my query is correct.


(Magnus Bäck) #4

But how can you say that it's not returning any results when you're not looking at the results? With

_, err := This.Client.Search().Index(This.Index).Query(query).Do()

you're throwing them away and only keeping the error.

If you want help please be specific. Does the line above return any results or not? Or does it return an error? What if you try the simplest possible query to help rule out that it's your query that's incorrect? Verify the correctness of whatever query you try with e.g. curl or Sense.


(Paulo Coutinho) #5

The current code is in this way because i need compile and push the code. So to avoid the unused variable warning i need use the "_". So ignore it, the code was "results, error := ...". This is not the problem, i only forgot explain it.


(system) #6