taraslayshchuk / es2csv

Export from an Elasticsearch into a CSV file
Apache License 2.0
510 stars 191 forks source link

Fields syntax error #20

Closed jmagnuss closed 7 years ago

jmagnuss commented 7 years ago

Not a regular Python user, so LMK if I have a bad version or something easy.

Getting a syntax error no matter what options I try:

# es2csv -u localhost:9200 -i 'logstash-2016-1*' -r '{"query": {"range":{"timestamp":{"gte":"2016-12-02 00:00:00","lte":"now","time_zone":"-08:00"}}}}' -o out.csv -f '@timestamp,_type,host,vhost,method,urlpath,origparams'
Traceback (most recent call last):
  File "/usr/bin/es2csv", line 7, in <module>
    from es2csv import main
  File "/usr/lib/python2.6/dist-packages/es2csv.py", line 211
    out = {field: hit[field] for field in META_FIELDS} if self.opts.meta_fields else {}
                               ^
SyntaxError: invalid syntax

Python:

Python 2.6.9 (unknown, Sep  1 2016, 23:34:36)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
jmagnuss commented 7 years ago

Nevermind, updating my Amazon Linux instance to use 2.7 properly resolved this.
Notes on switching versions here: https://aws.amazon.com/amazon-linux-ami/2015.03-release-notes/

taraslayshchuk commented 7 years ago

Duplication of issue #8