# MSSQL monitoring with Metricbeat?

**URL:** <https://discuss.elastic.co/t/mssql-monitoring-with-metricbeat/252733>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [October 20, 2020, 8:04pm UTC](https://discuss.elastic.co/t/mssql-monitoring-with-metricbeat/252733 "2020-10-20T20:04:16Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![ManuelF](https://avatars.discourse-cdn.com/v4/letter/m/e99b99/32.png) [@ManuelF](https://discuss.elastic.co/u/ManuelF)\
**Post date:** [October 21, 2020, 6:12pm UTC](https://discuss.elastic.co/t/mssql-monitoring-with-metricbeat/252733/5 "2020-10-21T18:12:24Z")

</div>

**Update**

I spent some time researching and trying different combinations. At the end it looks like the `sql` query is finally being executed without errors, as I don't see any in Metricbeat logs. The issue now is that not all the fields contained in the query are included in the index, when I check from Discovery. I was expecting at least a `-` when a field does not have a value to show.

**sql.yml**

```
- module: sql
  metricsets:
    - query
  period: 15s
  #hosts: ["user=myuser password=mypassword dbname=mydb sslmode=disable"]
  hosts: ["sqlserver://sa:123456aA@localhost"]
  dbname: "BikeStores"
  sslmode: "disable"
  driver: "mssql"
  sql_query: "
SELECT
 [Current LSN],
 [Transaction ID],
 [Operation],
 [Transaction Name],
 [CONTEXT],
 [AllocUnitName],
 [Page ID],
 [Slot ID],
 [Begin Time],
 [End Time],
 [Number of Locks],
 [Lock Information]
FROM sys.fn_dblog(NULL,NULL)
WHERE Operation IN 
   ('LOP_INSERT_ROWS','LOP_MODIFY_ROW',
    'LOP_DELETE_ROWS','LOP_BEGIN_XACT','LOP_COMMIT_XACT')"
  sql_response_format: table

```

**Discovery (Kibana)**

 ![sql_fields_missing](https://us1.discourse-cdn.com/elastic/original/3X/8/4/84d395fd0b97dde3a53d5cd99986b49324a8f861.png)

**Original query in MSSQL server**

 ![sql_result](https://us1.discourse-cdn.com/elastic/original/3X/f/7/f775eab3788b19678934e16219b7553941bec160.png)

---

_[View the full topic](https://discuss.elastic.co/t/mssql-monitoring-with-metricbeat/252733)._
