I'm trying to create a small script that will capture messages from the system log, for lets say the past hour. Looks like some kind of escape characters are being added to the front of my dates in the arsdoc statement..anyone have an idea?
---Output---
archive@server:/home/ondemand/scripts/errorMon> ./test.bash
+ hourAgo
+ now
+ echo 2020-12-22 14:52:29.264607 'Is an hour ago..'
2020-12-22 14:52:29.264607 Is an hour ago..
+ echo 2020-12-22 15:52:29.266762 'Is now..'
2020-12-22 15:52:29.266762 Is now..
+ arsdoc query -h archive -u admin -f 'System Log' -i $'WHERE time_stamp >= \'2020-12-22 14:52:29.264607\' and time_stamp < \'2020-12-22 15:52:29.266762\''
2020-12-22 15:52:29.350117: ARS1609W Specifying passwords on the command line is in-secure due to the text being visible. See the Installation and Configuration Guide for your platform for information about the arsstash command or using Unified Login.
2020-12-22 15:52:30.201722: ARS6007E The server failed during a search operation. View the System Log for additional messages.
From the system log - DB Error: [IBM][CLI Driver][DB2/LINUXX8664] SQL0420N Invalid character found in a character string argument of the function "DECFLOAT". SQLSTATE=22018 -- SQLSTATE=22018, SQLCODE=-420, File=arsdoc.c, Line=3088
---sample script:---
set -x
function hourAgo {
HOURAGO=$(date "+%Y-%m-%d %H:%M:%S.%6N" -d "1 hour ago")
}
function now {
NOW=$(date "+%Y-%m-%d %H:%M:%S.%6N")
}
hourAgo
now
echo $HOURAGO "Is an hour ago.."
echo $NOW "Is now.."
arsdoc query -h archive -u admin -p ondemand -f "System Log" -i "WHERE time_stamp >= '${HOURAGO}' and time_stamp < '${NOW}'"