그래서 내가 키바 지수와 상관 관계가 문자열 목록을 가지고, 문자열은 다음과 같이 :정렬 목록
λ curl '10.10.43.210:9200/_cat/indices?v'
health status index pri rep docs.count docs.deleted store.size pri.store.size
yellow open filebeat-2016.10.08 5 1 899 0 913.8kb 913.8kb
yellow open filebeat-2016.10.12 5 1 902 0 763.9kb 763.9kb
yellow open filebeat-2016.10.13 5 1 816 0 588.9kb 588.9kb
yellow open filebeat-2016.10.10 5 1 926 0 684.1kb 684.1kb
yellow open filebeat-2016.10.11 5 1 876 0 615.2kb 615.2kb
yellow open filebeat-2016.10.09 5 1 745 0 610.7kb 610.7kb
날짜는 분류되지 않은 돌아오고있다. 이 인덱스 (날짜)로 정렬하려면 filebeat-2016-10.xx ASC 또는 DESC가 정상입니다.
subp = subprocess.Popen(['curl','-XGET' ,'-H', '"Content-Type: application/json"', '10.10.43.210:9200/_cat/indices?v'], stdout=subproce$
curlstdout, curlstderr = subp.communicate()
op = str(curlstdout)
kibanaIndices = op.splitlines()
for index,elem in enumerate(kibanaIndices):
if "kibana" not in kibanaIndices[index]:
print kibanaIndices[index]+"\n"
kibanaIndexList.append(kibanaIndices[index])
을하지만 의미있는 방식으로 정렬 할 수 없습니다 : 지금의 약자로서
나는 다음과 같은 문자열을 격리 할 것.
를' kibanaIndices' list, 어떻게 보이는지 보여 줄 수 있니? –
kibanaIndices 목록은 위의 목록과 똑같습니다. 실수로 제거하지 않으려는 .kibana의 기본 색인이있는 행이 있습니다.이 스크립트는 로그 순환 용이므로 for 루프는 해당 항목을 제외하고 –
각 행이'yellow open filebeat-'로 시작하면 일반 정렬이 작동합니다. 정렬을 위해 시도한 것을 보여주십시오. –