Worklight v6 iwap - ibm-mobilefirst

I set up Worklight V6 Server and IWAP.
I found my worklight app console has analytics tab and there is IWAP console.
there is dashboad view, search view, search log view, geo analytics view.
then I put WL.Logger.error and WL.Analytics.log code in my app and issued these logs
but I cannot find any data on my IWAP console.
and there is following NumberFormatException in my IWAP logs. can I fix this?
[2013-06-24 18:02:35,998][DEBUG][action.search.type ] [Rattler] [worklight][7], node[M8YymIEGQbae4fbtkc2cyA], [P], s[STARTED]: Failed to execute [org.elasticsearch.action.search.SearchRequest#465651a2]
org.elasticsearch.search.SearchParseException: [worklight][7]: from[0],size[-1],sort[<custom:"worklight_data.timestamp": org.elasticsearch.index.field.data.longs.LongFieldDataType$1#79b8644>!]: Parse Failure [Failed to parse source [{"sort": {"worklight_data.timestamp": {"order": "desc"}}, "from": 0, "script_fields": {}, "facets": {}, "query": {"query_string": {"query": "worklight_data.log.message:* AND worklight_data.timestamp:[NaN TO * ]"}}, "size": 1000}]]
at org.elasticsearch.search.SearchService.parseSource(SearchService.java:566)
at org.elasticsearch.search.SearchService.createContext(SearchService.java:481)
at org.elasticsearch.search.SearchService.createContext(SearchService.java:466)
at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:236)
at org.elasticsearch.search.action.SearchServiceTransportAction.sendExecuteQuery(SearchServiceTransportAction.java:141)
at org.elasticsearch.action.search.type.TransportSearchQueryThenFetchAction$AsyncAction.sendExecuteFirstPhase(TransportSearchQueryThenFetchAction.java:80)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:205)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction.performFirstPhase(TransportSearchTypeAction.java:192)
at org.elasticsearch.action.search.type.TransportSearchTypeAction$BaseAsyncAction$2.run(TransportSearchTypeAction.java:178)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1121)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:614)
at java.lang.Thread.run(Thread.java:779)
Caused by: java.lang.NumberFormatException: For input string: "NaN"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:76)
at java.lang.Long.parseLong(Long.java:452)
at java.lang.Long.parseLong(Long.java:494)
at org.elasticsearch.index.mapper.core.LongFieldMapper.rangeQuery(LongFieldMapper.java:176)
at org.apache.lucene.queryParser.MapperQueryParser.getRangeQuerySingle(MapperQueryParser.java:342)
at org.apache.lucene.queryParser.MapperQueryParser.getRangeQuery(MapperQueryParser.java:331)
at org.apache.lucene.queryParser.QueryParser.Term(QueryParser.java:1496)
at org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:1319)
at org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:1275)
at org.apache.lucene.queryParser.QueryParser.TopLevelQuery(QueryParser.java:1234)
at org.apache.lucene.queryParser.QueryParser.parse(QueryParser.java:206)
at org.elasticsearch.index.query.QueryStringQueryParser.parse(QueryStringQueryParser.java:212)
at org.elasticsearch.index.query.QueryParseContext.parseInnerQuery(QueryParseContext.java:188)

Please check that the following:
1 - Are you using the developer edition? In Worklight v6, the Analytics console will not function in the developer edition. This may be changed in future releases. I have never seen that exception before, but I wonder if it occurs as a result of trying to run with the developer edition.
2 - In your initOptions.js, analytics has been set to true:
analytics : { enabled: true }
3 - In worklight.properties, you should set the queue size to 1 so that analytics are immediately seen on the console
wl.analytics.queue.size=1
Important Note The queue size should only be set to 1 in testing mode, as using 1 will not scale in production mode.
If you continue to have issues, please post more information such as the calls you are making to WL.Analytics.log and your worklight.properties for the analytics.
EDIT
If you are running Worklight 6.0 in development mode, you will need the following flag in worklight.properties:
wl.analytics.debug=true

Related

Azure Gateway WAF - Diagnostics Issue

I'm trying to setup Azure WAF (v2) on my App Gateway (currently in detection mode first to handle false positive cases), however, I'm seeing this warning:
To view your detection logs, you must have diagnostics enabled.
So, I went to Diagnostic settings and created it there with following options:
Log:
ApplicationGatewayAccessLog - (checked)
ApplicationGatewayPerformanceLog - (checked)
ApplicationGatewayFirewallLog - (checked)
Metric:
AllMetrics - (checked)
I have Send to Log Analytics checked as well. Also Archive to a storage account enabled.
But I'm still seeing the same warning mentioned above.
Any idea what I might be missing here?
UPDATE, I do see records within log with following query, but warning is still there:
AzureDiagnostics | where OperationName == "ApplicationGatewayFirewall"

Repeated IBM bluemix Node Red app crashing; status 1

My Node Red application in IBM BlueMix is repeatedly crashing - once an hour - with no real error message other than "exited with status: 1."
How can I troubleshoot this issue?
Is there someone from IBM BlueMix support that monitors this that could take a look?
I looked at my logs and there's nothing in there that really says what's going on.
Edit per requests:
The regular log for "OUT/ERR" is scrolling so fast with HTTPD logs that I can't get it to copy/paste. Filtering to "ERR" Channel the only thing I see is below. I believe this is an error which occurs during deploy when the application restarts.
[App/0] ERR js-bson: Failed to load c++ bson extension, using pure JS version
My Node Red application is gathering data from Wink, LIFX, and other IoT services and compiles them together into a Freeboard dashboard.
Caught crash on screenshot here -- not enough cred to post images so it'll only post as a link
The zlib error was fixed in the 0.13.2 Node-RED release (that shipped 19/02/16).
If you re-stage your application is should pick up the new version of Node-RED
You can re-stage the application using the cf command line management application:
cf restage <app name>

How to remove analytics logs in mobilefirst 6.3

We are working in a mobilefirst 6.3 project, and our .war is installed in a liberty profile server.
We didn't configure the TTL on the analytics before. is there any way (tool, rest service or file-system) that I can remove the analytics logs in mobilefirst.
MobileFirst Platform Foundation Analytics uses ElasticSearch and Lucene at its core - there is nothing special to be done from a MobileFirst perspective.
If you want to remove everything, the whole Analytics store:
Stop the Analytics server
Delete the "analyticsData" folder which is under servers/<server-name>/ in the Liberty installation
Restart the server
Otherwise, using either CURL or Postman you can invoke the DELETE query.
You can find the ElasticSearch API here: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html
Some additional questions about this topic in Stack Overflow:
Removing Data From ElasticSearch
Delete all documents from index/type without deleting type
http://www.tekkie.ro/quick-n-dirty/howto-quickly-erase-all-documents-from-an-elasticsearch-index/
Example steps:
Open the ES port - MobileFirst uses port 9500,
In the Analytics server set the JNDI property http.enabled=true and restart the Analytics server (if it's a cluster, you still only need to open the port on one of the cluster members)
The default "index" to use in your query is "worklight", and the mappings are documented in the user documentation, and are shown on the admin tab in the Analytics console
The endpoint for your delete query would need to be the Analytics server
Postman example query:
DELETE
http://your-analytics-server:9500/worklight/network_transactions/_query
{
"query": {
"range": {
"worklight_data.timestamp": {
"to": 1432313605000
}
}
}
}
CURL example query:
curl -X DELETE 'http://server:9500/worklight/network_transactions/_query' (http://server:9500/worklight/network_transactions/_query%27) -d '{ "query" : { "range" : { "timestamp" : { "lte" : "1432222333424" } } } }'

Getting VersionConflictEngineException in IBM Mobile First 6.3

I'm receiving the following message on server log in IBM Mobile First 6.3 every time an Adapter is getting called:
Stacktrace
[ERROR ] Error sending bulk request: java.lang.RuntimeException:
failure in bulk execution: [2]: index [worklight], type [devices], id
[b2deefe7-0d15-4ed4-b199-7e42440fc372], message
[VersionConflictEngineException[[worklight][1]
[devices][b2deefe7-0d15-4ed4-b199-7e42440fc372]: version conflict,
current [58], provided [57]]] at
com.ibm.elasticsearch.servlet.DataReceiver.processData(DataReceiver.java:132)
at
com.ibm.elasticsearch.servlet.DataReceiver.processDataLegacy(DataReceiver.java:85)
at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source) ...
The adapter is executed correctly and the response is returned to the app.
Any idea why this error is happening?
Help will be appreciated.
Thanks.
This is an internal error in analytics. The error itself is actually harmless, however the analytics platform should be catching it... A defect will be logged for the message. In the meantime, if you're not using analytics, you can disable it by removing the WAR files from the Liberty server.
If you are using analytics, then I would recommend clearing out the analytics data folder and restarting the IMF platform (this would remove any data you have stored in analytics). This is assuming that you are running in development mode. The analytics data folder can be in the same directory as the server.xml file for your Liberty server.

IBM Worklight 5.0.x - How to use console API for automation?

I'm looking for examples to control Worklight appclications via REST API for automation. What I need is a method to disable and enable specific application from command line.
I've found "HTTP Interface of the production server" on the IBM Worklight Information Center, but it doesn't work.
For exapmle, I sent a GET request to:
<WorklightServerURL>/worklight/console/api/getApplications
In return I got:
Error 404: Could not find resource for relative : /getApplications of
full path:
/worklight/console/api/getApplications".
Looking into the Worklight Console interactions using Chrome developer tool, disabling application request generates:
<WorklightServerURL>/worklight/console/api/applications/setAccessRule/17
Which is not consistent with the IBM Worklight Information Center...
This looks to be a documentation defect, where (in this specific case):
http://myhost:port/console/api/{Action}
Should be
http://myhost:port/console/api/applications/{Action}
For example:
http://myworklightserver:8080/console/api/applications/all
http://myworklightserver:8080/console/api/applications/get/testapp
I have opened a documentation defect to update the Console API Requests section. Thanks.
As for setAccessRule,
The API request structure is: http://myworklightserver:8080/console/api/applications/setAccessRule
The parameters are:
gadgetAppId (Required. You can find this in the database)
action (Required. delete | notify | block)
message (Required)
downloadLink (Optional)
Note that you are linking to the Worklight 5.0.5 Information Center; the fixes will appear in the Worklight 5.0.6 and 6.0 Information Center pages.
In Worklight 6.0 the port has changed to "10080", and a context root section exists before "/console".
http://myworklightserver:10080/mycontext/console/api/applications/all