Removeing http_access_yyyy_mm_dd.log file in wso2 API Manager - wso2

I have one problem with API Manager.
I don't want to have logs of requests and responses in API Manager, because those log files are so big and I encounter files with 20G. I tried to comment Catalina access file, which is in repositoy/conf/tomcat/catalina-server.xml:
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="${carbon.home}/repository/logs"
prefix="http_access_"
suffix=".log"
pattern="combined"/>
Unfortunately, after commenting the above code, only http_access_.log file didn't created, but http_access_yyyy_mm_dd.log was created and requests saved in it. I tried to change directory of above file, too. Only file http_access_.log saved in new directory, and http_access_yyyy_mm_dd.log is still created in the ${carbon.home}/repository/logs directory.
How can change configuration of http_access_yyyy_mm_dd.log in wso2 API Manager?

According to the Apache Documentation,
The name of the file is composed by concatenation of the configured
prefix, timestamp and suffix
You can simply comment out the code snippet which you have mentioned which can be found in <PRODUCT_HOME>\repository\conf\tomcat\catalina-server.xml.
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="${carbon.home}/repository/logs" prefix="http_access_" suffix=".log"b pattern="combined"/>
In simple comment the above code snippet in the mentioned file path and restart the WSO2 APIM server.

Related

Error occurred while generating PDF in Coldfusion using cfhtmltopdf

I am getting the following error using cfhtmltopdf:
Error occurred while generating PDF. Reason: PDF conversion is failed due to timeout. Increase the timeout value in PDFgService manager settings.
According to these docs (see "Configuring the PDF service manager"), I should be able to tweek the PDF Service Settings in the web.xml file:
https://helpx.adobe.com/coldfusion/pdf-generation-in-coldfusion.html
On Production, I am able to find the file and make these changes. It is located here:
//jetty/webapps/PDFgServlet/WEB-INF/.
However, locally, using CF2018 Developer Edition using IIS Server Mode, I cannot find any reference to any PDF service settings in any of the web.xml files in my CF directories. This folder also does not exist: //jetty/webapps/PDFgServlet/WEB-INF/.
I did find locally this folder:
C:\ColdFusion2018\cfusion\hf-updates\hf-2018-00003-314033\jetty\webapps\PDFgServlet\WEB-INF
There was no web.xml file there though, and adding one in with the settings had no effect (after restarting CF).
So I'd like to know how does one change these PDF settings in a local/development environment like this, like I was able to do on Production, in order to further debug this error I am getting.
UPDATE: We have logged the underlying issue with Adobe: https://tracker.adobe.com/#/view/CF-4208624

Tomcat: Cannot load the credentials from the credential profiles file of AWS

I'm implementing a REST Api which need download files from Amazon S3.
When I call the api, it gives me the exception:
com.amazonaws.AmazonClientException: Cannot load the credentials from the credential profiles file. Please make sure that your credentials file is at the correct location (~/.aws/credentials), and is in valid format.
Then I run the same method API called, it succeeded. I'm using tomcat 9.0.2, my guess is the default credential directory ~/.aws/credential is different for tomcat application.
So I checked $CATALINA_HOME, which is /opt/apache-tomcat-9.0.2 and I copied the credentials there, still not working.
First time asking questions here, I hope that I expressed my issue clearly. Thanks for any help from anybody.
The home directory ~ depends on the user running the Tomcat server, so if Tomcat is running as the root user, for example, you'd need to place the credentials in /root/.aws/credentials.
Depending on the Tomcat version, you can usually find the default user in /etc/default/tomcat7. It would appear as something like:
TOMCAT7_USER=tomcat7
In that case, the home directory would be /home/tomcat7, and thus the credentials would go in /home/tomcat7/.aws/credentials.

How to submit a job, by using an uploaded jar in Apache Flink?

I've already uploaded a jar (which was generated through a word count java program) to Apache Flink web console through an HTTP Post request via curl and the get jars api shows the uploaded jar.
When I try to submit a job using that jar, it throws me this error:
Caused by: org.apache.flink.client.program.ProgramInvocationException:
JAR file does not exist
'/tmp/flink-web-8aa36f99-87fb-4fbc-b155-237fd833fc32/:949611ce-345a-4cd5-986b-8ff9b0700852_WordCount.jar'
This is how my POST request looks like:
http://localhost:8081/jars/:949611ce-345a-4cd5-986b-8ff9b0700852_WordCount.jar/run
I followed their official docs for reference. Where am i going wrong? Any help could be appreciated.
Ensure that the jar file is located in your temp directory. There is a ':' in path, is it correct?
I study REST API recently and successfully submit my job with POST request
http://host:port/jars/29525e98-3ece-49c1-85d1-5301a5a38900_myjob.jar/run?allowNonRestoredState=false&entry-class=&parallelism=&program-args=&savepointPath=
Also you can submit job via Flink Dashboard and detect correct url through Chrome DevToos at Network tab (or something like this)

WSO2 ESB: Getting Dead Pages When Running in Windows Service

I'm getting blank pages when navigating the WSO2 ESB-4.9.0 management console. For example, the registry, templates, endpoints, and local entries pages are all blank when navigating to them in the console UI.
I've found the following errors in the logs:
Error during rendering
IO Error executing tag: JSPException while including path '/templates/list_templates.jsp'. ServletException while including page.
The ESB is running in a YAJSW Windows Service. I should note that the ESB runs fine when running straight from the command line, it's just when using the service wrapper.
Strainy
Since you mentioned that the ESB starts as a window service, in carbon 4.4.x, default wrapper.conf file needs to be updated with following additional entries.
wrapper.java.additional.26 = -Dwso2.carbon.xml=${carbon_home}\\repository\\conf\\carbon.xml
wrapper.java.additional.27 = -Dwso2.registry.xml=${carbon_home}\\repository\\conf\\registry.xml
wrapper.java.additional.28 = -Dwso2.user.mgt.xml=${carbon_home}\\repository\\conf\\user-mgt.xml
wrapper.java.additional.29 = -Dwso2.transports.xml=${carbon_home}\\repository\\conf\\mgt-transports.xml
wrapper.java.additional.31 = -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false
wrapper.java.additional.33 = -Dfile.encoding=UTF8
You can verify these configurations in wrapper.conf and these configurations may help you to solve the jsp error.
Following link may help you if you need more information regarding this.
https://docs.wso2.com/display/ESB490/Installing+as+a+Windows+Service#InstallingasaWindowsService-SettinguptheYAJSWwrapperconfigurationfile
I just used the NSSM - the "Non-Sucking Service Manager".
It's actually amazingly simple to install a Service using this tool.
https://nssm.cc
Just set it up to point at the wso2server.bat file
Keeping an eye on this issue however: https://wso2.org/jira/browse/ESBJAVA-4342

WSO2 ESB read from a file

I need to perform below two task.
First read the content of a file and append those content to response message of service using WSO2 ESB.
Second - I need to read a file from a source directory without moving or deleting that file from source directory.
Can anybody suggest possible way to perform above operations.
You can use VFS transport?
And
the sample http://docs.wso2.org/pages/viewpage.action?pageId=26838852
I have created class mediator to do on demand read from a file and its successfully working.
First create a class mediator project - a java class that reads the file content and add those to synapse-config body.
Put that jar file in ESB_HOME/repository/component/lib
restart server and now that class will be available in ESB. :)
Below are the reference tutorials.
http://rajikak.blogspot.in/2010/03/writing-class-mediator-for-wso2-esb-300.html
http://www.nuwanbando.com/2013/06/reading-an-xml-file-into-wso2-esb-transform-it-and-expose-it-as-an-api/#more-1009
http://docs.wso2.org/display/ESB470/Places+for+Putting+Custom+Mediators