copyright: years: 2017, 2023 lastupdated: "2023-01-07"
Using Elasticsearch for call metrics
Starting with version 1.0.3.0, Voice Gateway supports the ability to integrate with a Logstash server. Thereafter, you can use Elasticsearch queries in order to monitor metrics such as total call length and maximum concurrent calls during the configured interval.
Note that you need to configure Voice Gateway to print log messages in JSON format. For more details see Configuring logging and tracing for Voice Gateway.
Metrics are periodically printed into the Voice Gateway log files. The respective log message id is CWSGW0145I.
ext_callLength_int - contains calls length is seconds during the configured interval.
ext_maxConcurrentCalls_int - contains the maximum concurrent calls during the configured interval.
- Configuring Voice Gateway with a Logstash server
- Environment variables
- Elasticsearch queries examples
Configuring Voice Gateway with a Logstash server
Follow the Liberty instructions in order to configure the Voice Gateway with a logstash server, but skip steps 4(c), 4(d) and 4(e).
See the instructions in Securing Voice Gateway on how to configure trust and key stores in Voice Gateway.
Environment variables
The following Docker environment variables are used to configure the log settings:
| Environment variable | Default | Description |
|---|---|---|
| LOGSTASH_ENABLED | false |
Possible values are true and false. The Logstash feature is enabled when the environment variable is set to true. |
| LOGSTASH_SOURCE | message |
The list of comma-separated sources that route to the Logstash server. Valid values are message, trace, accessLog, ffdc, and audit. |
| LOGSTASH_SERVER_HOST | None |
The Logstash server hostname. |
| LOGSTASH_SERVER_PORT | None |
The Logstash server port. |
| LOGSTASH_TAG | vgw |
The tag to be used for the log messages generated by Voice Gateway. |
| LOG_METRICS_SAMPLING_INTERVAL | 300 |
The interval between when Voice Gateway metrics are written to the logs, measured in seconds. |
Elasticsearch queries example
The following query calculates total calls length based on date range, from 2019-08-22T10:00:00.000Z to 2019-08-23T00:00:00.000Z.
GET /logstash/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"messageId": "CWSGW0145I"
}
},
{
"range": {
"datetime": {
"gte": "2019-08-22T10:00:00.000Z",
"lte": "2019-08-23T00:00:00.000Z"
}
}
},
{
"range": {
"ext_callLength_int": {
"gt": 0
}
}
}
]
}
},
"aggs": {
"total_call_length": {
"sum": {
"field": "ext_callLength_int"
}
}
},
"size": 0
}