Tell me more ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an logstash instance with ElasticSearch Index. I trying to run some queries against to this index via command line, because I would like to monitor some log items in this index, because I use logstash as a central logging server.

But I am totall missed in query language, and I cannot find a correct part of documentation for solve my problem.

I trying to search some specific log messages. My mapping seems as following:

{
  "syslog": {
    "properties": {
      "@fields": {
        "dynamic": "true",
        "properties": {
          "received_at": {
            "type": "date",
            "format": "dateOptionalTime"
          },
          "received_from": {
            "type": "string"
          },
          "syslog_facility": {
            "type": "string"
          },
          "syslog_facility_code": {
            "type": "long"
          },
          "syslog_pri": {
            "type": "string"
          },
          "syslog_program": {
            "type": "string"
          },
          "syslog_severity": {
            "type": "string"
          },
          "syslog_severity_code": {
            "type": "long"
          }
        }
      },
      "@message": {
        "type": "string"
      },
      "@source": {
        "type": "string"
      },
      "@source_host": {
        "type": "string"
      },
      "@source_path": {
        "type": "string"
      },
      "@tags": {
        "type": "string"
      },
      "@timestamp": {
        "type": "date",
        "format": "dateOptionalTime"
      },
      "@type": {
        "type": "string"
      }
    }
  }
}

The query what I want to run is something like: @source.host:myhost AND syslog_program:exim4

I do this query against my ES server:

curl -ks http://localhost:9200/syslog-2012.10.27/syslog/_search?q=syslog_program:exim4%20AND%20@source_host:myhost

What I want is ordering result by received_at and limiting to last 2-3 items.

share|improve this question
I dont think you can find much help in serverfault regarding your question because it is related to a query language not servers. please post your on stackoverflow.com, you will find more help. – Hex Oct 28 '12 at 0:11

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.