simple definition of expected output to provided input
But unfortunately I am unable to run any test with success and always get this error:
2016/02/16 12:58:29 Waiting for child with pid 58724 to terminate.
Error running Logstash: exit status 1. The process gave no output.
Do I need to provide the input somehow next to the argument? Or am I overlooking something? sample example I am trying to run:
logstash-filter-verifier test.json logstash.conf
test.json
{
"codec": "json",
"ignore": ["host", "@timestamp"],
"input": [
"{\"message\": \"This is a test message\"}"
],
"expected": [
{
"message": "This is a test message"
}
]
}
Please use Logstash Filter Verifier 1.0.1 which gives better error output when Logstash fails. It also fixes an incompatibility issue with Logstash 2.2.0 (which has also been fixed in Logstash 2.2.1).
Secondly, don't include any inputs or outputs in the configuration file(s) you feed LFV with. Just filters. The documentation should be more clear about this.
yeah, that's true, it's mac, and I confirm my mistake too
the story is that I earlier downloaded the amd64 package and then realized my mistake so I changed just the binary with the one from darwin distribution
When the message field contains "test" a _jsonparsefailure tag is to be expected since the input string clearly isn't JSON. I can't reproduce what you describe on Linux:
$ cat test.config
filter { }
$ cat test.json
{
"codec": "json",
"ignore": ["host", "@timestamp"],
"input": [
"{\"message\": \"This is a test message\"}"
],
"expected": [
{
"message": "This is a test message"
}
]
}
$ logstash-filter-verifier --loglevel=DEBUG test.json test.config
2016/02/16 16:20:35 Reading test case file: test.json (/tmp/trash.s2LA/test.json)
2016/02/16 16:20:35 Starting "/opt/logstash/bin/logstash" with args ["/opt/logstash/bin/logstash" "-w" "1" "--debug" "-e" "input { stdin { codec => \"json\" add_field => { } } } output { file { path => \"/tmp/736256972\" codec => \"json_lines\" } }" "--log" "/tmp/145950395" "--config" "test.config"].
2016/02/16 16:20:35 Waiting for child with pid 16737 to terminate.
Comparing message 1 of test.json...
2016/02/16 16:20:39 Starting "/usr/bin/diff" with args ["-u" "/tmp/399511262/test.json/0/expected" "/tmp/399511262/test.json/0/actual"].
I do have a Mac OS X machine at my disposal so I'll have to try it out there.
Hi, I discussed with terramexx and found solution. In file /logstash-filter-verifier/logstash/process.go on line 82 is set one env variable for logstash process. All real evn variables are then lost including JAVA_HOME. Logstahs than not able to find java. I changed this code
It was actually intentional to drop the current environment and only set TZ (so that tests are hermetic), but JAVA_HOME should in that case also be propagated.
LFV obviously needs to care about the stdout/stderr of the Logstash program and not just its log.
Continue with a clean environment that only sets TZ=UTC but
add a --keep-env option that allows callers to specify the name of additional environment variables that should be propagated to the Logstash processes.
You need Go 1.8, released last week. I'm going to add a note about this requirement to the readme file but haven't found the time. Sorry for the trouble.
Thanks Magnus.
It compiled once I installed 1.8 and removed the Ubuntu repository version of 1.2.1.
However, now I get an error that logstash wasn't found. Using the example on your Github page for the syslog.json and test.config I ran :
./logstash-filter-verifier syslog.json test.config
and received the following output.
Running tests in syslog.json...
fork/exec /opt/logstash/bin/logstash: no such file or directory
Logstash 5.2 for Ubuntu 14.04, at least, is in /usr/share/logstash on Linux. I suspect I have to change this in the .go file and then recompile? It seems there is no way to discover this from the environment?
Am I on the right track to fix this? I did download it for windows as well - which failed for the same reason.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.