A non-auto load osquery logger plug-in - osquery

Can I have a non-auto load osquery plugin. i.e. A plugin executable which will start on it's own and not by osqueryd and still connect to osqueryd and register for a logger plugin? Or is it mandatory that osqueryd itself launches the plugin executable?

Yes, you can absolutely do this. As long as the plugin is provided the correct path to the osquery extension socket, and has the appropriate permissions to open the socket, it can register at any time.
There is an example in the osquery-go readme.

Related

How to transport a Selenium package to a client environment?

I need to develop a automation package using selenium and send it over to a different location and completely different environment so that it will aid in the testing's happening there. It has to be able to be integrated with Jenkins for the build run. Also it should be a data driven package.
how will I be able to do that?
You need to create repository and upload the tests there and provide access to the client. You can use service like Github or Gitlab. You can have private repository for up to 3 contributors.
You can parametrize the test using property file or system property variables.
If you need more information about how the system properties work you can check this article: https://www.baeldung.com/java-system-get-property-vs-system-getenv
Something like this:
System.getProperty("log_dir", "/tmp/log");
mvn clean test -DpropertyName=value
If you want to send the project like a jar file then it will be like:
System.getProperty("baseUrl", "https://mywebsite.com");
java -jar jarName -DbaseUrl=https://someotheraddress.com

Get SLF4J running without coping anything into WebLogic lib-directory

I need to make SLF4J working inside the WebLogic application. According to Buttso [1] and Oracle [2], one need to copy files into domain/lib directory:
slf4j-api
slf4j-jdk14-1.6.0.jar
Then define the following handler in logging.property file:
handlers = weblogic.logging.ServerLoggingHandler
and start WebLogic with following parameter attached.
-Djava.util.logging.config.file=C:\tmp\logging.properties
I understand why the property file must be defined globally. But I don't understand, why JARs must be copied into domain/lib directory of the WebLogic. I tries to leave them inside my WAR file, but it doesn't work.
Is there a way to retain the log libraries under the control of the application? Where is this limitation come from? It is possible to utilize the JDK14 logging infrastructure of the Weblogic directly from the application as:
java.util.logging.Logger LOGGER = java.util.logging.Logger.getLogger("my.logger.Name");
LOGGER.info("JDK14 Anonymous info");
It works as expected. The handler weblogic.logging.ServerLoggingHandler is able to successfully intercept the message and forward it into WSL log file. Why SLF4J bridge is not able to do the same?
[1] Using SLF4J with WebLogic Server Logging
http://buttso.blogspot.com/2011/06/using-slf4j-with-weblogic-server.html
[2] How to Redirect SLF4J to the WebLogic Logging System?
https://support.oracle.com/epmos/faces/DocumentDisplay?id=1507456.1 (Oracle subscription needed)
SHOT DESCRIPTION:
It works perfectly with SLF4J packaged with the application. The important thing is that the API slf4j-api and the implementation slf4j-jdk14 must be loaded by the same classloader.
LONG DESCRIPTION:
By default the Weblogic classloader has a priority. If both libraries (slf4j-api and slf4j-jdk14) are located in domain/lib directory nothing can go wrong.
If slf4j-api is located in the application classpath but NOT in the Weblogic classpath, two things can happen:
SLF4J finds some wrong implementation packaged with the application. For example it could be a logback as mandatory dependency of some third party library. In this case the messages will be forwarded into the wrong implementation and they won't reach the WebLogic logging infrastructure.
SLF4J finds some implementation inside the WebLogic classpath. In this case the application will be most probably fail to be deployed because of ClassCastException.
As I said, it is possible to have all the SLF4J logging libraries inside the application. For example it is needed, if the WebLogic server is a shared instance and not under your control. Two things are needed to be done:
Ensure that only a single SLF4J implementation is packaged with the application. In our case it is slf4j-jdk14. Do maven clean to be sure, all the leftovers from previous tries are removed from WAR file!
Enforce the usage of the application classloader for loading the SLF4J library. It is done by WEB-INF/weblogic.xml like this:
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.9/weblogic-web-app.xsd">
<wls:weblogic-version>14.1.1.0</wls:weblogic-version>
<wls:context-root>test-oauth</wls:context-root>
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>org.slf4j.*</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
</wls:weblogic-web-app>
Here is a useful example how to find out, which classloader was responsible for a given class or instance.
Which classloader loaded a class of the provided instance

selenium-server-standalone.jar maven dependency

I am using Maven as a build tool. On selniumhq site I can see selenium-server-standalone.jar file but I could not found related Maven dependency. Is there any maven dependency for selenium standalone file?
latest selenium standalone file is : selenium-server-standalone-3.2.0.jar
Note : I want to execute code on Remote desktop machine using Selenium grid (which require aforementioned jar file)
I think you should refer to this manual first: http://www.seleniumhq.org/docs/07_selenium_grid.jsp#starting-selenium-grid
i.e. in order to use grid you need you need to create grid instance first by running commands
from command line, then you need to register node, again by using command line, and after that from your code you need to create instance of RemoteWebDriver (refer to this page for more details: http://www.seleniumhq.org/docs/04_webdriver_advanced.jsp#remotewebdriver).
If, for some reason, you want to to create grid\register nodes from your project maybe it makes sense to download it to your resources folder, execute it from there using Runtime (refer to this link for more details: http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html) and then connect to it. But I would strongly recommend avoiding doing so.

Apache Ant Build output to file using only log4j

I am developing a java project using Eclipse as IDE and ant as the build tool. For logging I am making use of log4j library. I am able to get the log messages in a log file for my whole application using log4j configuration. But when I build project using ANT, the ANT build messages are still posted to console.I want to make sure that when I build the project, the build messages that ANT generates, like build failure/success, should also be posted to that sames logger file using log4j.
Please help me in this if anyone has got an idea in detail. Thanks
You can make use of Log4jListener available in ant.
Your log4j.properties file would look something like this
log4j.rootLogger=ERROR, LogFile
log4j.logger.org.apache.tools.ant.Project=INFO
log4j.logger.org.apache.tools.ant.Target=INFO
log4j.logger.org.apache.tools.ant.taskdefs=INFO
log4j.logger.org.apache.tools.ant.taskdefs.Echo=WARN
log4j.appender.LogFile=org.apache.log4j.FileAppender
log4j.appender.LogFile.layout=org.apache.log4j.PatternLayout
log4j.appender.LogFile.layout.ConversionPattern=[%6r] %8c{1} : %m%n
log4j.appender.LogFile.file=build.log
And you when you run the ant build you have to pass the listener argument as follows -
ant -listener org.apache.tools.ant.listener.Log4jListener
For the above command to work your log4j.porperites and the log4j jar sould be on the ant classpath. This way your build logs will go to both console and the file build.log

IBM MobileFirst war file unable to deploy to MFP server

I had tried deploy both war file without java and jar files and with java and jar files. The war file without java and jar files managed to deploy successfully without any error in the log. The runtime appear in the admin console and everything works.
If I deploy server/java and jar war files, my runtime will disappear from the admin console. Here is my java lib,
I am using the IBM Server Configuration Tool to deploy war.
axis.jar
bcprov-jdk14-143.jar
commons-discovery-0.2.jar
commons=logging.jar
CryptoPasswordTool_14.jar
e2eejslib2048_b1.4_v1.3jar
jaxrpc.jar
jcprov.jar
saaj.jar
wsdl4j.jar
xerces-2.9.1.jar
Here is my Java call
javax.xml.rpc.Service aacmService = javax.xml.rpc.ServiceFactory.newInstance().createService(new java.net.URL(connectionUrl),new javax.xml.namespace.QName(ssoLink, "SSOService"));
These library had been used in my server/java to make some customized server call.Is there any of these jar files that will crash with MFP?
In this environment, I unable to get to copy anything out from the server due to the client policy. But I managed to take a shot on the screen.
Without proper information to review, such as the complete log file to see all errors printed, the recommendation is to open a PMR instead of a question on stack overflow, which anyway is more suitable for programming questions rather than infrastructure questions.
Open a support ticket to IBM: http://www-01.ibm.com/support/docview.wss?uid=swg21507643