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!
Yes, this is possible, APM data is like any other data in elasticsearch, so you have access to it.
Here is a good documentation on how APM data is stored - you can just query those indices.
You are the best! @GregKalapos Thank you!!
Answered the same question on Stack Overflow, including here for completeness.
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")
)
)
);
Thank you for the detailed explanation!
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.