0

I have an asp.net core web app application that will write logs using serilog to elasticsearch and also can read the logs from elasticsearch using NEST. I also have it set up where I can use APM for my application. If I wanted to retrieve the transactions that are in APM using NEST or the transactions on a specific date, is this something possible? Any advice/tutorial/documentation on this would be great!

enter image description here

NoviceCoder
  • 449
  • 1
  • 9
  • 26

1 Answers1

1

You'll want to target the apm-*-transaction aliase(s)

In Kibana Dev tools

GET apm-*-transaction/_search
{
  "query": {
    "range": {
      "@timestamp": {
        "gte": "2021-06-04T00:00:00Z",
        "lte": "2021-06-05T00:00:00Z"
      }
    }
  }
}

In NEST (change dynamic to your document type)

var client = new ElasticClient();
    
var searchResponse = client.Search<dynamic>(s => s
    .Index("apm-*-transaction")
    .Query(q => q
        .DateRange(dr => dr
            .Field("@timestamp")
            .GreaterThanOrEquals("2021-06-04T00:00:00Z")
            .LessThanOrEquals("2021-06-05T00:00:00Z")
        )
    )
);
Russ Cam
  • 124,184
  • 33
  • 204
  • 266