nxshell - Database failure on eventlog query
-
-
Check "LogFile" parameter in server config(NETXMSHOME/etc/netxmsd.conf or /etc/netxmsd.conf). If it is not defined try to check something like /var/log/netxmsd.
-
Optimal log level for debugging problems is 6.
-
Good to know. We're currently running really hard on Debug levels, I think. The only relevant line I could find in any of the five (netxmsd.0/1/2/3/4) logfiles was this:
[20-Jun-2016 12:31:54.204] [DEBUG] [CLSN-4] User [email protected] authenticated (language=en clientInfo="nxjclient/2.0.3 (Linux 3.19.0-58-generic; libnxcl 2.0.3)")Our debug level is currently at 6. We have a million of these messages:
[20-Jun-2016 12:31:54.245] [DEBUG] [CLSN-4] Sending message CMD_OBJECTwhich is making it a bit hard to read through the logs. Searching for "database" "nxc" or similar terms got me nothing. Any guesses? Should I try to dig into the postgresql logs?
Thanks,
Zach -
That was it! I looked in the postgresql log:
2016-06-20 12:37:31 EDT ERROR: column "source" does not exist at character 159
2016-06-20 12:37:31 EDT STATEMENT: SELECT event_id,event_timestamp,event_source,dci_id,event_code,event_severity,event_message,user_tag,root_event_id FROM event_log WHERE event_id<=934558 AND (Source BETWEEN 0 AND 8153) LIMIT 1000I guess the column isn't named Source? I'll have to look in the postgresql database to see what's there, unless you have a better idea of the column name.
Thanks,
Zach -
The name is "event_source". UI is hiding column real names. You should use names that are defined in database.
-
One last question, I hope! It appears to not be filtering anything. Running the following code, I get five events, 10, 11, 12, 13, 109. The filter should have spat out 27628, right? If I pull the columnfilter from the logfilter, I get that the filter is still in place, but I don't seem to get any filtering. Any guesses?
eventLog = session.openServerLog("EventLog") columnFilter = ColumnFilter(ColumnFilter.EQUALS,27628) columnFilter.setNumericValue(27628) logFilter = LogFilter() logFilter.setColumnFilter("event_id",columnFilter) #print(columnFilter.getNumericValue()) #print(columnFilter.getOperation()) fill = logFilter.getColumnFilter("event_id") print(fill.getNumericValue()) eventLog.query(logFilter) table = eventLog.retrieveData(0,5) for j in range(table.getRowCount()): #for i in range(table.getColumnCount()): print(table.getColumnDisplayName(0)) print(table.getCellValue(j,0))output is:
27628 [output of fill.getNumericValue()]
event_id
10
event_id
11
event_id
12
event_id
13
event_id
109 -
For some quick information, I chose this event because it was not filtering on event_severity, so I gave ID a try, and it seems to similarly not work. I have pasted the event below, so that you can see it exists.
27628 19.05.2016 11:56:32 Karmaloop-R1 0 SYS_NODE_CRITICAL Critical Node status changed to CRITICAL 0
-
I found problem. It's bad class declaration. You want function "public ColumnFilter(int type, long value)" to be used, but both values are counted like long and class is created like: "public ColumnFilter(long rangeFrom, long rangeTo)". So your values were counted like a range. Type should be change to Enum type. I have created bug on it: https://dev.raden.solutions/issues/1245.
Temporary solution:
import java.lang.Integer
eventLog = session.openServerLog("EventLog")columnFilter = ColumnFilter(java.lang.Integer(ColumnFilter.EQUALS),363)
logFilter = LogFilter()
logFilter.setColumnFilter("event_id",columnFilter)
... -
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login