#{{ server.Server.Id }} - {{ server.Server.Name }}
You need to set the following parameter in RDS Parameter Groups:
log_min_duration_statement
100
Create a database user with CREATE SESSION and SELECT_CATALOG_ROLE privileges.
Download the agent nazar-cli (Requires Java 1.8+).
Replace [HOST:PORT], [USER], [PASSWORD] and [SID] or /[SERVICE_NAME].
Schedule the command below to run every 20 minutes.
java -jar nazar-cli.jar \
--access-key-id {{ "server-" + uuid(server.Server.Id, 12) }} \
--database {{ server.Server.Database }} \
--aws-access-key-id {{ server.Credentials.AccessKeyId }} \
--aws-secret-access-key {{ server.Credentials.SecretAccessKey }} \
--endpoint [HOST:PORT] \
--user [USER] \
--password [PASSWORD] \
--db-instance-name [SID] or /[SERVICE_NAME]
Remember to give the privileges CREATE SESSION and SELECT_CATALOG_ROLE to the database user informed.
Verify if your firewall rules allow external access to the host and port where SQL Server is running (default port is 1433). from IP 52.44.38.67.
Create a database user with VIEW SERVER STATE permission.
Download the agent nazar-cli (Requires Java 1.8+).
Replace [HOST:PORT], [USER] and [PASSWORD].
Schedule the command below to run every 20 minutes.
java -jar nazar-cli.jar \
--access-key-id {{ "server-" + uuid(server.Server.Id, 12) }} \
--database {{ server.Server.Database }} \
--aws-access-key-id {{ server.Credentials.AccessKeyId }} \
--aws-secret-access-key {{ server.Credentials.SecretAccessKey }} \
--endpoint [HOST:PORT] \
--user [USER] \
--password [PASSWORD]
Remember to give the permission VIEW SERVER STATE to the database user informed.
Verify if your firewall rules allow external access to the host and port where SQL Server is running (default port is 1433). from IP 52.44.38.67.
You can do it in the AWS Management Console,
or using the aws-cli code below.
modify-db-parameter-group --parameters nazar-io --cli-input-json
{
"Version": "2012-10-17",
"Statement": [
{
"ParameterName": "log_min_duration_statement",
"ParameterValue": "100"
}
]
}
{
"Version": "2012-10-17",
"Statement": [
{
"ParameterName": "slow_query_log",
"ParameterValue": "1"
}, {
"ParameterName": "log_output",
"ParameterValue": "FILE"
}, {
"ParameterName": "long_query_time",
"ParameterValue": "0.1"
}
]
}
#{{ server.Server.Id }} - {{ server.Server.Name }}
You need to set the following parameters in Azure Portal:
log_line_prefix
'%t:%r:%u@%d:[%p]:'
log_min_duration_statement
100
Create a database user with VIEW DATABASE STATE permission.
Create a database user with VIEW SERVER STATE permission.
Download the agent nazar-cli (Requires Java 1.8+).
Replace [HOST:PORT], [USER], [PASSWORD] and [DB_INSTANCE_NAME].
Replace [HOST:PORT], [USER] and [PASSWORD].
Schedule the command below to run every 20 minutes.
java -jar nazar-cli.jar \
--access-key-id {{ "server-" + uuid(server.Server.Id, 12) }} \
--database {{ server.Server.Database }} \
--aws-access-key-id {{ server.Credentials.AccessKeyId }} \
--aws-secret-access-key {{ server.Credentials.SecretAccessKey }} \
--endpoint [HOST:PORT] \
--user [USER] \
--password [PASSWORD] \
--db-instance-name [DB_INSTANCE_NAME]
java -jar nazar-cli.jar \
--access-key-id {{ "server-" + uuid(server.Server.Id, 12) }} \
--database {{ server.Server.Database }} \
--aws-access-key-id {{ server.Credentials.AccessKeyId }} \
--aws-secret-access-key {{ server.Credentials.SecretAccessKey }} \
--endpoint [HOST:PORT] \
--user [USER] \
--password [PASSWORD]
Remember to give the permission VIEW SERVER STATE to the database user informed.
Verify if your firewall rules allow external access to the host and port where SQL Server is running (default port is 1433). from IP 52.44.38.67.
You can do it in the Azure Portal,
or using the azure-cli code below.
az postgres server configuration set --name log_line_prefix --resource-group myresourcegroup --server mydemoserver --value '%t:%r:%u@%d:[%p]:'
az postgres server configuration set --name log_min_duration_statement --resource-group myresourcegroup --server mydemoserver --value 100
az mysql server configuration set --name slow_query_log --resource-group myresourcegroup --server mydemoserver --value on
az mysql server configuration set --name log_output --resource-group myresourcegroup --server mydemoserver --value FILE
az mysql server configuration set --name long_query_time --resource-group myresourcegroup --server mydemoserver --value 0.1
#{{ server.Server.Id }} - {{ server.Server.Name }}
Edit the postgresql.conf file in your PostgreSQL server. Add or modify the following parameters:
log_min_duration_statement = 100
log_line_prefix = '%t:%r:%u@%d:[%p]:'
lc_messages = 'C'
logging_collector = on
log_destination = 'stderr'
log_statement = 'none'
log_filename = 'postgresql-%a_%H.log'
log_truncate_on_rotation = on
log_rotation_age = 60
log_rotation_size = 0
Download the agent nazar-cli (Requires Java 1.8+).
Replace [PATH] with the value where you'll put the gzipped log files.
Schedule the command below to run hourly.
java -jar nazar-cli.jar \
--access-key-id {{ "server-" + uuid(server.Server.Id, 12) }} \
--database {{ server.Server.Database }} \
--aws-access-key-id {{ server.Credentials.AccessKeyId }} \
--aws-secret-access-key {{ server.Credentials.SecretAccessKey }} \
--method uploader \
--log-path [PATH]
Edit the my.cnf (Linux and Mac OS) or my.ini (Windows) file in your {{ database }} server. Locate the [mysqld] section in the file, and add or modify the following parameters:
slow_query_log = 1
log_output = FILE
long_query_time = 0.1
Download the agent nazar-cli (Requires Java 1.8+).
Replace [PATH] with the value where you'll put the gzipped log files.
Schedule the command below to run hourly.
java -jar nazar-cli.jar \
--access-key-id {{ "server-" + uuid(server.Server.Id, 12) }} \
--database {{ server.Server.Database }} \
--aws-access-key-id {{ server.Credentials.AccessKeyId }} \
--aws-secret-access-key {{ server.Credentials.SecretAccessKey }} \
--method uploader \
--log-path [PATH]
Create a database user with CREATE SESSION and SELECT_CATALOG_ROLE privileges.
Download the agent nazar-cli (Requires Java 1.8+).
Replace [HOST:PORT], [USER], [PASSWORD] and [SID] or /[SERVICE_NAME].
Schedule the command below to run every 20 minutes.
java -jar nazar-cli.jar \
--access-key-id {{ "server-" + uuid(server.Server.Id, 12) }} \
--database {{ server.Server.Database }} \
--aws-access-key-id {{ server.Credentials.AccessKeyId }} \
--aws-secret-access-key {{ server.Credentials.SecretAccessKey }} \
--endpoint [HOST:PORT] \
--user [USER] \
--password [PASSWORD] \
--db-instance-name [SID] or /[SERVICE_NAME]
Remember to give the privileges CREATE SESSION and SELECT_CATALOG_ROLE to the database user informed.
Verify if your firewall rules allow external access to the host and port where SQL Server is running (default port is 1433). from IP 52.44.38.67.
Create a database user with VIEW SERVER STATE permission.
Download the agent nazar-cli (Requires Java 1.8+).
Replace [HOST:PORT], [USER] and [PASSWORD].
Schedule the command below to run every 20 minutes.
java -jar nazar-cli.jar \
--access-key-id {{ "server-" + uuid(server.Server.Id, 12) }} \
--database {{ server.Server.Database }} \
--aws-access-key-id {{ server.Credentials.AccessKeyId }} \
--aws-secret-access-key {{ server.Credentials.SecretAccessKey }} \
--endpoint [HOST:PORT] \
--user [USER] \
--password [PASSWORD]
Remember to give the permission VIEW SERVER STATE to the database user informed.
Verify if your firewall rules allow external access to the host and port where SQL Server is running (default port is 1433). from IP 52.44.38.67.