Grafana using Postgres database

Hi,

I am using Grafana ver 6.4 with Azure Postgres as database. I was able to connect, initialize and migrate data to Postgres successfully. I can see list of data sources when query in my postgres instance. select * from data_source;

However, when I create a new dashboard and alert. I am unable to see corresponding records in postgres.

select * from dashboard; => 0 results
select * from alert; => 0 result

Which makes me believe that grafana is still using default sqllite database to store dashboard/alert.

Am I missing something? How can I access default sqllite database to verify my assumption?

Thanks.

Check the settings through

@danielgonzalez sorry for delayed response due to holidays and shutdown.

"database": {
    "ca_cert_path": "",
    "cache_mode": "private",
    "client_cert_path": "",
    "client_key_path": "",
    "conn_max_lifetime": "14400",
    "connection_string": "",
    "host": "nishpostgresqlserver.postgres.database.azure.com:5432",
    "log_queries": "false",
    "max_idle_conn": "2",
    "max_open_conn": "0",
    "name": "mypgsqldb",
    "password": "************",
    "path": "grafana.db",
    "server_cert_name": "",
    "ssl_mode": "require",
    "type": "postgres",
    "url": "",
    "user": "grafanareader@nishpostgresqlserver"
  } 

I still cannot see dashboards and alerts created via UI as records in database tables.

I switched on query logging and now I can see CRUD operation statements being logged such as

INSERT INTO \"dashboard\" (\"uid\",\"slug\",\"org_id\",\"gnet_id\",\"version\",\"plugin_id\",\"created\",\"updated\",\"updated_by\",\"created_by\",\"folder_id\",\"is_folder\",\"has_acl\",\"title\",\"data\") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15) RETURNING \"id\" []interface {}{\"W2q2olEWz\", \"loggerdashboard\", 1, 0, 1, \"\", \"2020-01-16 17:42:49\", \"2020-01-16 17:42:49\", 1, 1, 0, false, false, \"LoggerDashboard\", \"{\\\"annotations\\\":{\\\"list\\\":[{\\\"builtIn\\\":1,\\\"datasource\\\":\\\"-- Grafana --\\\",\\\"enable\\\":true,\\\"hide\\\":true,\\\"iconColor\\\":\\\"rgba(0, 211, 255, 1)\\\",\\\"name\\\":\\\"Annotations \\\\u0026 Alerts\\\",\\\"type\\\":\\\"dashboard\\\"}]},\\\"editable\\\":true,\\\"gnetId\\\":null,\\\"graphTooltip\\\":0,\\\"hideControls\\\":false,\\\"id\\\":null,\\\"links\\\":[],\\\"panels\\\":[{\\\"aliasColors\\\":{},\\\"bars\\\":false,\\\"dashLength\\\":10,\\\"dashes\\\":false,\\\"datasource\\\":\\\"ADX-dev\\\",\\\"fill\\\":1,\\\"fillGradient\\\":0,\\\"gridPos\\\":{\\\"h\\\":9,\\\"w\\\":12,\\\"x\\\":0,\\\"y\\\":0},\\\"id\\\":2,\\\"legend\\\":{\\\"avg\\\":false,\\\"current\\\":false,\\\"max\\\":false,\\\"min\\\":false,\\\"show\\\":true,\\\"total\\\":false,\\\"values\\\":false},\\\"lines\\\":true,\\\"linewidth\\\":1,\\\"nullPointMode\\\":\\\"null\\\",\\\"options\\\":{\\\"dataLinks\\\":[]},\\\"percentage\\\":false,\\\"pointradius\\\":2,\\\"points\\\":false,\\\"renderer\\\":\\\"flot\\\",\\\"seriesOverrides\\\":[],\\\"spaceLength\\\":10,\\\"stack\\\":false,\\\"steppedLine\\\":false,\\\"targets\\\":[{\\\"database\\\":\\\"Metrics\\\",\\\"query\\\":\\\"Log\\\\n| where $__timeFilter(TimeStamp)\\\\n| where RecordType == \\\\\\\"NetworkResponse\\\\\\\"\\\\n| where Data.status != 200\\\\n| summarize count() by bin(TimeStamp, $__interval) \\\\n| order by TimeStamp asc\\\",\\\"refId\\\":\\\"A\\\",\\\"resultFormat\\\":\\\"time_series\\\"}],\\\"thresholds\\\":[],\\\"timeFrom\\\":null,\\\"timeRegions\\\":[],\\\"timeShift\\\":null,\\\"title\\\":\\\"Panel Title\\\",\\\"tooltip\\\":{\\\"shared\\\":true,\\\"sort\\\":0,\\\"value_type\\\":\\\"individual\\\"},\\\"type\\\":\\\"graph\\\",\\\"xaxis\\\":{\\\"buckets\\\":null,\\\"mode\\\":\\\"time\\\",\\\"name\\\":null,\\\"show\\\":true,\\\"values\\\":[]},\\\"yaxes\\\":[{\\\"format\\\":\\\"short\\\",\\\"label\\\":null,\\\"logBase\\\":1,\\\"max\\\":null,\\\"min\\\":null,\\\"show\\\":true},{\\\"format\\\":\\\"short\\\",\\\"label\\\":null,\\\"logBase\\\":1,\\\"max\\\":null,\\\"min\\\":null,\\\"show\\\":true}],\\\"yaxis\\\":{\\\"align\\\":false,\\\"alignLevel\\\":null}}],\\\"schemaVersion\\\":20,\\\"style\\\":\\\"dark\\\",\\\"tags\\\":[],\\\"templating\\\":{\\\"list\\\":[]},\\\"time\\\":{\\\"from\\\":\\\"now-6h\\\",\\\"to\\\":\\\"now\\\"},\\\"timepicker\\\":{},\\\"timezone\\\":\\\"\\\",\\\"title\\\":\\\"LoggerDashboard\\\",\\\"uid\\\":\\\"W2q2olEWz\\\",\\\"version\\\":1}\"}

but still don’t see records on psql. I double checked and confirm db creds on both end (grafana and psql cli) and they match. I am out of any ideas to identify where is data being stored. Please help.

Issue resolved. PSQL select * query was not returning records. It worked well when searched on individual recs like select * from dashboard where id = 1;

1 Like