Component(s)
receiver/sqlquery
Is your feature request related to a problem? Please describe.
I'd like to additional support for logs in the sqlquery receiver that allows me to statically assign attributes to logs (similar to metrics), assign the log timestamp from a database column (similar to metrics), and set the event name on a LogRecord based on the contents of a database column. The absence of the ability to set the timestamp and event name in particular are preventing reporting of particular details in our log system. The static attributes are a really nice quality of life feature on metrics in this receiver that would be great to mirror in logs.
Describe the solution you'd like
I'd like to add configuration items static_attributes, ts_column, and event_name_column configuration in the logs portion of the sqlquery receiver.
Example config:
receivers:
sqlquery:
driver: postgres
datasource: "host=localhost port=5432 user=postgres password=s3cr3t sslmode=disable"
storage: file_storage
queries:
- sql: "select * from my_logs where log_id > $$1"
tracking_start_value: "10000"
tracking_column: log_id
logs:
- body_column: log_body
attribute_columns: ["log_attribute_1", "log_attribute_2"]
static_attributes:
dbinstance: mydbinstance
ts_column: log_ts
event_name_column: log_event_name
I would like static_attributes and ts_column configuration provided in this way to work exactly the same way as their companion settings in the metrics section: setting log attributes statically, and setting the log timestamp from the provided column. I'd imagine leaving how the observed timestamp is currently set would capture the difference in actual log creation time vs log scrape time.
I would like event_name_column to set the LogRecord's event name based on the content of what's in the row at that column. Additionally, I'd like to relax the requirement that body_column be set when event_name_column is set: an empty string body is apparently fine on an event (even expected, if I correctly understand event semantics).
Describe alternatives you've considered
For static attributes, I can just inject static values into my SQL query and get those with attribute_columns. Awkward, but doable.
I don't think there's any way to get timestamps or event names into the logs produced from the sqlquery receiver. I suppose I could add them to attributes on the LogRecord, then use a transform processor to re-shape the log how I want. That's a bit tedious.
Additional context
I might look into implementing this myself if there's no issues with the request. Seems pretty simple to implement.
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.
Component(s)
receiver/sqlquery
Is your feature request related to a problem? Please describe.
I'd like to additional support for logs in the sqlquery receiver that allows me to statically assign attributes to logs (similar to metrics), assign the log timestamp from a database column (similar to metrics), and set the event name on a LogRecord based on the contents of a database column. The absence of the ability to set the timestamp and event name in particular are preventing reporting of particular details in our log system. The static attributes are a really nice quality of life feature on metrics in this receiver that would be great to mirror in logs.
Describe the solution you'd like
I'd like to add configuration items
static_attributes,ts_column, andevent_name_columnconfiguration in the logs portion of the sqlquery receiver.Example config:
I would like
static_attributesandts_columnconfiguration provided in this way to work exactly the same way as their companion settings in the metrics section: setting log attributes statically, and setting the log timestamp from the provided column. I'd imagine leaving how the observed timestamp is currently set would capture the difference in actual log creation time vs log scrape time.I would like
event_name_columnto set theLogRecord's event name based on the content of what's in the row at that column. Additionally, I'd like to relax the requirement thatbody_columnbe set whenevent_name_columnis set: an empty string body is apparently fine on an event (even expected, if I correctly understand event semantics).Describe alternatives you've considered
For static attributes, I can just inject static values into my SQL query and get those with
attribute_columns. Awkward, but doable.I don't think there's any way to get timestamps or event names into the logs produced from the sqlquery receiver. I suppose I could add them to attributes on the LogRecord, then use a transform processor to re-shape the log how I want. That's a bit tedious.
Additional context
I might look into implementing this myself if there's no issues with the request. Seems pretty simple to implement.
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding
+1orme too, to help us triage it. Learn more here.