Tuesday, January 13, 2015

elasticsearch commands (example) to see the logs from logstash

$ curl -gs -XGET http://localhost:9200/logstash-\*/_search\?pretty\=true

{
  "took" : 104,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 6,
    "max_score" : 1.0,
    "hits" : [ {
      "_index" : "logstash-2015.01.13",
      "_type" : "nginx_access",
      "_id" : "AUrh27PSn9XFZmqFmD71",
      "_score" : 1.0,
      "_source":{"message":"172.16.255.1 - - [13/Jan/2015:05:54:33 +0000] \"GET / HTTP/1.1\" 304 0 \"-\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0\"","@version":"1","@timestamp":"2015-01-13T05:54:33.792Z","host":"node1","path":"/var/log/nginx/access.log","type":"nginx_access","tags":["_grokparsefailure"]}
    }, {
      "_index" : "logstash-2015.01.13",
      "_type" : "nginx_access",
      "_id" : "AUrh3bkHn9XFZmqFmD75",
      "_score" : 1.0,
      "_source":{"message":"172.16.255.1 - - [13/Jan/2015:05:56:51 +0000] \"GET / HTTP/1.1\" 304 0 \"-\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0\"","@version":"1","@timestamp":"2015-01-13T05:56:51.780Z","host":"node1","path":"/var/log/nginx/access.log","type":"nginx_access","tags":["_grokparsefailure"]}
    }, {
      "_index" : "logstash-2015.01.13",
      "_type" : "nginx_access",
      "_id" : "AUrh26y1n9XFZmqFmD70",
      "_score" : 1.0,
      "_source":{"message":"172.16.255.1 - - [13/Jan/2015:05:54:32 +0000] \"GET / HTTP/1.1\" 304 0 \"-\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0\"","@version":"1","@timestamp":"2015-01-13T05:54:32.773Z","host":"node1","path":"/var/log/nginx/access.log","type":"nginx_access","tags":["_grokparsefailure"]}
    }, {
      "_index" : "logstash-2015.01.13",
      "_type" : "nginx_access",
      "_id" : "AUrh27PSn9XFZmqFmD72",
      "_score" : 1.0,
      "_source":{"message":"172.16.255.1 - - [13/Jan/2015:05:54:34 +0000] \"GET / HTTP/1.1\" 304 0 \"-\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0\"","@version":"1","@timestamp":"2015-01-13T05:54:34.817Z","host":"node1","path":"/var/log/nginx/access.log","type":"nginx_access","tags":["_grokparsefailure"]}
    }, {
      "_index" : "logstash-2015.01.13",
      "_type" : "nginx_access",
      "_id" : "AUrh27PSn9XFZmqFmD73",
      "_score" : 1.0,
      "_source":{"message":"172.16.255.1 - - [13/Jan/2015:05:54:35 +0000] \"GET / HTTP/1.1\" 304 0 \"-\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0\"","@version":"1","@timestamp":"2015-01-13T05:54:35.820Z","host":"node1","path":"/var/log/nginx/access.log","type":"nginx_access","tags":["_grokparsefailure"]}
    }, {
      "_index" : "logstash-2015.01.13",
      "_type" : "nginx_access",
      "_id" : "AUrh28f_n9XFZmqFmD74",
      "_score" : 1.0,
      "_source":{"message":"172.16.255.1 - - [13/Jan/2015:05:54:44 +0000] \"GET / HTTP/1.1\" 304 0 \"-\" \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:34.0) Gecko/20100101 Firefox/34.0\"","@version":"1","@timestamp":"2015-01-13T05:54:44.841Z","host":"node1","path":"/var/log/nginx/access.log","type":"nginx_access","tags":["_grokparsefailure"]}
    } ]
  }
}

No comments:

Post a Comment