NDrive / graylog-archiver

Archives graylog indices.
MIT License
13 stars 6 forks source link

IndexError: list index out of range in graylog_elasticsearch.py #6

Open Frusecer opened 6 years ago

Frusecer commented 6 years ago
2018-06-30 14:09:46,373 [INFO] Indices: ['new_deflector', 'graylog_deflector', 'cl_0']
Traceback (most recent call last):
  File "/usr/local/bin/graylog-archiver", line 9, in <module>
    load_entry_point('graylog-archiver==0.1.4', 'console_scripts', 'graylog-archiver')()
  File "/usr/local/lib/python3.5/dist-packages/graylog_archiver/cli.py", line 33, in main
    archiver.archive()
  File "/usr/local/lib/python3.5/dist-packages/graylog_archiver/graylog_archiver.py", line 18, in archive
    indices = self.graylog.indices_to_archive()
  File "/usr/local/lib/python3.5/dist-packages/graylog_archiver/graylog_elasticsearch.py", line 28, in indices_to_archive
    indices_sorted = sort_indices(self.indices())
  File "/usr/local/lib/python3.5/dist-packages/graylog_archiver/graylog_elasticsearch.py", line 15, in sort_indices
    return sorted(indices, key=extract_number, reverse=True)
  File "/usr/local/lib/python3.5/dist-packages/graylog_archiver/graylog_elasticsearch.py", line 10, in extract_number
    return int(re.findall(r'\d+', index)[0])
IndexError: list index out of range
:~$ curl http://localhost:9200/_cat/indices
green  open cl_0              ZRaJEV32SnO7NTpbC75zqA 4 0 26117570 0  7.8gb  7.8gb
yellow open new_deflector     7n_nZABDT5CpAabZLCy-cw 5 1     4843 0  3.9mb  3.9mb
yellow open graylog_deflector doSV3jTWRZ6IjvLel0vWsw 5 1 69565743 0 20.5gb 20.5gb
# uname -a
Linux syslog 4.4.0-128-generic #154-Ubuntu SMP Fri May 25 14:15:18 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
# cat /etc/issue
Ubuntu 16.04.4 LTS \n \l
# cat graylog_archiver.json 
{
  "elasticsearch": {
    "hosts": "localhost"
  },
  "max_indices": 3,
  "backup_dir": "/srv/backups/elasticsearch/graylog",
  "delete": false
}
# dpkg -l | grep graylog
ii  graylog-2.4-repository              1-6                                        all          Package to install Graylog 2.4 GPG key and repository
ii  graylog-server                      2.4.5-1                                    all          Graylog server
tivrobo commented 5 years ago

see #9