iamseth / oracledb_exporter

Prometheus Oracle database exporter.
MIT License
479 stars 236 forks source link

Scrape for log metrics #289

Open danielfobooss opened 1 year ago

danielfobooss commented 1 year ago

Hello,

Is it possible to scrape for log metrics in this exporter? I have tried including this is custom-metrics.toml but nothing happens:

[[log]] context = "orderpdb_alertlogs" logdesc = "alert logs for order PDB" timestampfield = "ORIGINATING_TIMESTAMP" request = "select ORIGINATING_TIMESTAMP, MODULE_ID, EXECUTION_CONTEXT_ID, MESSAGE_TEXT from V$diag_alert_ext"

I'm just wondering if this feature is included or not? If yes where is it? If not any advice on where/how to implemented it?

Thank you

Yannig commented 1 year ago

Hi,

I don't understand what you want to do.

Can you give an example of the request result?

Maybe you can also show the metrics you want as examples?

danielfobooss commented 1 year ago

Thanks for the reply.

I wanted to monitor oracle db logs, for instance imagine I do an invalid query, as a consequence I obtain this this message:

ORA-00904: "STAT_NAME": invalid identifier

I want grafana to be able to collect oracle db logs so that I can monitor potential errors (like the one i just showed) and create alerts.

I was wondering if the exporter could also export logs or is it only metrics. From what i know i think the .toml files support [[log]] entries and not only [[metric]] entries.

This query (in my oracle db): select ORIGINATING_TIMESTAMP, MODULE_ID, EXECUTION_CONTEXT_ID, MESSAGE_TEXT from V$diag_alert_ext returns something like this: image I want grafana to be able to have someting like this (example of grafana agents logs): image but for the previous query.

Is it possible/implemented?

Thank you

Yannig commented 1 year ago

Prometheus handle only metrics.

If you want you can add a metric with the last log time for example but not the logs directly.

You can store text using labels for example but it's not a good practice: each new set of labels result in a new time series. This behaviour have a direct impact on the index quality/size: you should try to avoid modifications on labels content for this reason.

If you need to retrieve logs, you should use something like Loki, Elasticsearch or equivalent.

Regards

serdargurdal commented 1 year ago

I have same issue with this Oracle internal view v$diag_alert_ext. Oracle exporter cannot read this view anyway. Is there any update or solution about this case ?