When using the /usr/share/ovirt-engine/dbscripts/engine-psql.sh script with the -c option, the results of the command are logged in the log file, but the command used is not log. Version-Release number of selected component (if applicable): redhat-support-plugin-rhev-3.6.* How reproducible: 100% Steps to Reproduce: 1. # /usr/share/ovirt-engine/dbscripts/engine-psql.sh -c "select * from storage_pool;" 2. View resulting log file in /var/log/ovirt-engine/db-manual Actual results: Result of query logged but not command run Expected results: Command that was run as well as results Additional info: This is particularly important with update and delete queries because without logging the command, the only clue we have of what the customer may have done is useless logs such as "DELETE 1" that contain no context.
Without '-a' tee will overwrite the specified file. Everything was logged correctly to LOGFILE up until this point, but then tee is overwriting LOGFILE with the output of psql command.
# /usr/share/ovirt-engine/dbscripts/engine-psql.sh -c "select 1" ?column? ---------- 1 (1 row) # zcat /var/log/ovirt-engine/db-manual/20160607171954-engine-psql.log.gz Tue Jun 7 17:19:54 EDT 2016: executing command : /usr/share/ovirt-engine/dbscripts/engine-psql.sh -c select 1 output: ?column? ---------- 1 (1 row) result: 0 # /usr/share/ovirt-engine/dbscripts/engine-psql.sh -f /root/test.sql ?column? ---------- 1 (1 row) # zcat /var/log/ovirt-engine/db-manual/20160607172005-engine-psql.log.gz Tue Jun 7 17:20:05 EDT 2016: executing command : /usr/share/ovirt-engine/dbscripts/engine-psql.sh -f /root/test.sql file content is: select 1 output: ?column? ---------- 1 (1 row) result: 0
Alex, could you please take a look?
My sh skills are non-existent, but I can certainly apply the patch that adds -a to line 85 command as provided by Derrick Ornelas. Looks like a fairly trivial change to me. I didn't write the script it was dropped in my lap with a note saying its yours now. @Derrick is that what you want me to do? Can you verify that it solves your problem?
Ahh, sorry Alex, now I remember that GSS wanted this script to be included in support-plugin. To me this change make sense, but I think GSS should approve the change (as they have requested this script to be included). Marina?
Yes, this is very needed by GSS. And this is actually a regression, since it used to work: https://bugzilla.redhat.com/show_bug.cgi?id=1071458 Please please please fix it!
+1 for this, thanks! :)
redhat-support-plugin-rhev-4.0.0-7.el7ev.noarch