Make function for logstash query encoding

The reviews for
Change id: Ie572ef90a3393b43d28608b95a8a9b24bd014962
included feedback to create a new common function to encode
logstash urls from query strings as this was happening in
two different places.

Adding new function to query_builder.py - encode_logstash_query.
Altered graph.py and uncategorized_fails.py to reflect these
changes and to use the new common function.

Change-Id: I75294ee4c0005eebcd107bf63cfd954c4a44806c
Merge "Make function for logstash query encoding"