benjamin_maquet
05/06/2022, 12:33 PMlogging.yaml
file. This works well but there’s still something we’d like to change because it makes it hard to read logs. After each log line, we get some extra values, e.g.
cmd_type=loader job_id=tap-salesforce-sfdc-period-target-presto-parquet name=target-presto-parquet run_id=87924270-556e-483e-ae97-5ff9f6fd2ab7 stdio=stderr
Here’s our logging.yaml
file:
version: 1
disable_existing_loggers: false
formatters:
default:
format: "[%(asctime)s] [%(process)d|%(threadName)10s|%(name)s] [%(levelname)s] %(message)s"
structured_plain:
(): meltano.core.logging.console_log_formatter
colors: False
structured_colored:
(): meltano.core.logging.console_log_formatter
colors: True
key_value:
(): meltano.core.logging.key_value_formatter
sort_keys: False
json:
(): meltano.core.logging.json_formatter
handlers:
console:
class: logging.StreamHandler
level: INFO
formatter: structured_plain
stream: "<ext://sys.stderr>"
file:
class: logging.FileHandler
level: INFO
filename: /var/log/meltano.log
formatter: json
root:
level: INFO
propagate: yes
handlers: [console, file]
and here’s a sample log file:
INFO Used 1582855 of 39932200 daily REST API quota cmd_type=extractor job_id=tap-salesforce-sfdc-period-target-presto-parquet name=tap-salesforce run_id=87924270-556e-483e-ae97-5ff9f6fd2ab7 stdio=stderr
INFO METRIC: {"type": "counter", "metric": "record_count", "value": 408, "tags": {"endpoint": "Period"}} cmd_type=extractor job_id=tap-salesforce-sfdc-period-target-presto-parquet name=tap-salesforce run_id=87924270-556e-483e-ae97-5ff9f6fd2ab7 stdio=stderr
INFO Setting state to {'bookmarks': {'Period': {'version': 1651764951849, 'SystemModstamp': '2022-05-04T12:46:22.000000Z'}}} cmd_type=loader job_id=tap-salesforce-sfdc-period-target-presto-parquet name=target-presto-parquet run_id=87924270-556e-483e-ae97-5ff9f6fd2ab7 stdio=stderr
INFO Completed sync for Period cmd_type=extractor job_id=tap-salesforce-sfdc-period-target-presto-parquet name=tap-salesforce run_id=87924270-556e-483e-ae97-5ff9f6fd2ab7 stdio=stderr
INFO Finished sync cmd_type=extractor job_id=tap-salesforce-sfdc-period-target-presto-parquet name=tap-salesforce run_id=87924270-556e-483e-ae97-5ff9f6fd2ab7 stdio=stderr
we would like to remove all the extra cmd_type=extractor job_id=tap-salesforce-sfdc-period-target-presto-parquet name=tap-salesforce run_id=87924270-556e-483e-ae97-5ff9f6fd2ab7 stdio=stderr
and have the log file as below instead
INFO Used 1582855 of 39932200 daily REST API quota
INFO METRIC: {"type": "counter", "metric": "record_count", "value": 408, "tags": {"endpoint": "Period"}}
INFO Setting state to {'bookmarks': {'Period': {'version': 1651764951849, 'SystemModstamp': '2022-05-04T12:46:22.000000Z'}}}
INFO Completed sync
INFO Finished sync
Does anyone have any idea how to make that happen? I’ve tried to update the logging.yaml
file in many different ways but without success…
Thanks a mil!fred_reimer
05/06/2022, 6:42 PMdefault
. Set your formatter to default under handlers.console, then play around with the format string...benjamin_maquet
05/06/2022, 7:49 PMmessage
object contains a bunch of keys, from which I only want one: event
. Unfortunately, I'm not able to extract only this one event
key because it's a dict formatted as a string…fred_reimer
05/12/2022, 1:57 PMbenjamin_maquet
05/12/2022, 9:02 PMkamal_singh_naruka
01/13/2023, 10:35 AM