I am running Grafana Agent (static mode) successfully to send metrics of a MSSQL database running on Windows Server 2022. I got there by following this tutorial.
But using the above gives this error in the Windows Event Viewer: level=info component=logs logs_config=integrations msg="failed to tail file" error="file is a directory" filename=D:\SqlServerData\MSSQL16.MSSQL2022STD\MSSQL\Log
Whatâs the secret to specifying the location? Assuming I get it working, will I be able to see all of the log files shown above? Some are .txt files simply stating the backup was successful, while others are SQL system health, SQL errors, etc. Iâd like to see everything in my cloud Loki.
Is the D drive an actual disk on the server or some remote share/nas virtual disk? Or drive letter mapping to a remote file share
For test purposes move a couple of those logs to a simple path such as
D:/lokilogs/ and see what happens
__path__: D:/lokilogs/* i think is the way to go
Folder name length
If you open cmd line on the server and type dir /x. What do you see for SqlServerData as short folder name Then cd into SqlServerData and again do dir /x what do you see as short folder name for the parenr folder for log
Creating the new simple path of D:/lokilogs and placing some log files into that new folder worked! (but donât open the champagne just yetâŚkeep reading)
__path__: D:/lokilogs/* does indeed work
In cmd line, I typed fsutil 8dot3name query and it says: The registry state is: 2 (Per volume setting - the default)
and the dir /x indicates to me that I do not have short folder names working
There are 3 remaining issues:
Itâs puzzling to me that the Grafana Agent accepts short paths like D:/lokilogs but will not accept D:/SqlServerData/MSSQL16.MSSQL2022STD/MSSQL/Log Is this indeed intended behavior?
The SQL log is encoded as UTF-16LE acc. to Edit Pad, which it seems acc. to this thread is still an unresolved issue. Per this, I put an encoding line into my yaml file and it resulted in Chinese characters
The dates/times in the raw logs use the time at which the log file was last updated (2023-05-19 07:48:05) for every log entry, even though each of those log entries has a different day/time. Is this preventable / correctable, and if so, how?
I havenât personally run into this before since I havenât had to deal with utf-16le encoding. May be a good idea to try with a newer version of promtail. I can also test it too, if @grant2 can share a sample log file.
2023-05-10 08:36:55.98 Server Microsoft SQL Server 2022 (RTM) - 16.0.1000.6 (X64)
Oct 8 2022 05:58:25
Copyright (C) 2022 Microsoft Corporation
Developer Edition (64-bit) on Windows 10 Pro 10.0 <X64> (Build 19045: ) (Hypervisor)
2023-05-10 08:36:55.99 Server UTC adjustment: -7:00
2023-05-10 08:36:55.99 Server (c) Microsoft Corporation.
2023-05-10 08:36:55.99 Server All rights reserved.
2023-05-10 08:36:55.99 Server Server process ID is 7276.
2023-05-10 08:36:55.99 Server System Manufacturer: 'Dell Inc.', System Model: 'Latitude 7490'.
2023-05-10 08:36:55.99 Server Authentication mode is MIXED.
2023-05-10 08:36:55.99 Server Logging SQL Server messages in file 'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Log\ERRORLOG'.
2023-05-10 08:36:55.99 Server The service account is 'NT Service\MSSQLSERVER'. This is an informational message; no user action is required.
2023-05-10 08:36:55.99 Server Registry startup parameters:
-d C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\master.mdf
-e C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Log\ERRORLOG
-l C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\DATA\mastlog.ldf
2023-05-10 08:36:55.99 Server Command Line Startup Parameters:
-s "MSSQLSERVER"
@tonyswumac I am using Grafana Agent version v0.33.2 (static mode) which I believe is the latest and greatest. My understanding is that Grafana Agent combines Prometheus for metrics, Loki for logs, and Grafana Tempo for traces. But maybe Promtail by itself would avoid this whole encoding issue? I would be grateful if you could run my error log through your Promtail setup. I will send to you via direct message.
Loki uses Goâs regular expression library to parse log files. Regular expressions are a powerful tool for matching patterns in text. Loki uses regular expressions to extract the timestamp, source, and message from each log line.
I may have spoken too soon. I think the encoding does indeed mess up the parsing, and itâs why my timestamp configuration did not work. I am testing sending with encoding and see if it works or not.
I am really looking forward to a fix for the UTF-16 encoding for the MSSQL logs. We have been ingesting them for 6 months and there are pretty much useless as is.