Jetty no longer includes request URL path as part of thread id? - jetty

We are using Logback with Jetty and our appender config looks like:
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{0} - %msg%n</pattern>
</encoder>
</appender>
With Jetty 7.5.4 the %thread property would be expanded to include the URL path of the request along with the thread id -- something like [qtp2105333421-78 - /requested/url]
Since upgrading to 7.6.8 it appears that the request path is no longer included -- logs now contain only [qtp2105333421-78].
I've only been able to find discussion of someone trying to exclude the request path from the log. I'm trying to include it now that it's missing and I couldn't find anything that sounded relevant in the Jetty changelog. Is this something that has been removed, or is it possible to change the logging pattern to get access to the request path again?

The request path in the Thread name is a DEBUG only features in 7.5.4
See org.eclipse.jetty.server.HttpConnection.handleRequest() from Jetty 7.5.4 line #407
It is still present as a DEBUG feature, but the move to Jetty 7.6.x had some refactoring that might be biting you.
See org.eclipse.jetty.server.AbstractHttpConnection.handleRequest() from Jettty 7.6.10 line #431.
Note the class change HttpConnection to AbstractHttpConnection

Related

adding a custom plugin to google-fluentd

I need to capture file descriptors for a given process. This is simular to what collectd's processes plugin does, but need to get this on the fluentd, google-fluentd specifically rails.
I've added my plugin under /etc/google-fluentd/plugin directory and no luck, it is not getting registered. I've even moved under /opt/google-fluentd/embedded/lib/ruby/gems/2.6.0/gems/fluentd-1.7.4/lib/fluent/plugin still no luck. Out of desperation I have also tried renaming in_tail.rb to in_tail2.rb and tail plugin is gone.
2020-08-14 18:28:16 -0700 [error]: fluent/log.rb:362:error: config error file="/etc/google-fluentd/google-fluentd.conf" error_class=Fluent::ConfigError error="Unknown input plugin 'tail'. Run 'gem search -rd fluent-plugin' to find plugins"
Which tells me that there is some other place where plugin must be mentioned. Is it too naive to think that I can just write a single file plugin under /etc/google-fluentd/plugin?
After a few hours of going up and down the call stack in the fluentd trying to figure out the logic behind why and which plugins fluentd loads here is what I figured out.
#type has to match registration call and filename!
ie i had used
#type fc_count
my filename was
/etc/google-fluentd/in_fd.rb
with
Fluent::Plugin.register_input('fd_count', self)
Although type and registration matched, fluent couldn't match file path to plugin/in_fd.rb as it loads configuration. Basically if you don't use a plugin it won't load it and the way it determines it is by going through config. This is the reason why when I renamed an existing input plugin it was no longer found.

Changing default base URL of Sitecore ServiceApiController, Is it possible?

when we implement SitecoreApiController, for each action method we make using Sitecore.Services.Core.ServicesController("namespace") attribute, we get a url like this:
/sitecore/api/ssc/{namespace}/{controller}/{id}/{action}
I wonder if we could change this default pattern, somehow in config files. I particularly interested in /sitecore/api/ part, because sometimes in the sense of security concerns, certain clients don't like to reveal that much about CMS platform behind the scene. Sometimes they even ask us to hide anything in HTTP header that tells about Microsoft ASP.NET explicitly.
Is this possible here?
Edit
this link shows a way to customize it using pipelines but I wonder if we could change the base url just through config files without needing a custom pipeline
I had a look at it, and I think I found out how - although I haven't tested it.
It looks for a setting named Sitecore.Services.RouteBase and if it can't find it, it uses sitecore/api/ssc/ as the default value.
You should be able to change it with a config patch like this in the App_Config/Include folder:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<settings>
<setting name="Sitecore.Services.RouteBase" value="custom/api/" />
</settings>
</sitecore>
</configuration>

What is the meaning of the leading slash / in Tomcat's <url-pattern>?

I know I cannot use regular expressions for the <url-pattern> of a filter-mapping, but is it possible to use a directory pattern to specify any url containing the word myuniqws as in:
https://my.hostname.org/myuniqws/myport/soap?wsdl
I am thinking of perhaps this would be the correct syntax:
<url-pattern>/*myuniqws*</url-pattern>
but I have not been able to find documentation for the exact rule of Tomcat's <url-pattern> syntax.
Will the above regex work as I desire?
Update:
Thanks to the answer below, I discovered the following section in the Java Servlet Specification, which basically answers my questions.
12.2 Specification of Mappings
In the Web application deployment descriptor, the following syntax is used to define
mappings:
A string beginning with a ‘/’ character and ending with a ‘/*’ suffix is used for
path mapping.
A string beginning with a ‘*.’ prefix is used as an extension mapping.
The empty string ("") is a special URL pattern that exactly maps to the application's context root, i.e., requests of the form http://host:port/<contextroot>/. In this case the path info is ’/’ and the servlet path and context path is empty string (““).
A string containing only the ’/’ character indicates the "default" servlet of the application. In this case the servlet path is the request URI minus the context path and the path info is null.
All other strings are used for exact matches only.
If the effective web.xml (after merging information from fragments and annotations) contains any url-patterns that are mapped to multiple servlets then the deployment must fail.
Presumably, you mean the <url-pattern> for filter mappings in web.xml. You might not know this, but web.xml is defined as part of the Java Servlet Specification. You can find full documentation for the 3.1 version (currently, the latest and greatest) here:
https://jcp.org/aboutJava/communityprocess/final/jsr340/index.html
If you read section 12.2 ("Specification of Mappings") you can see exactly what kinds of patterns are recognized, including the prefix-mapping you are requesting above.
EDIT 2014-11-04:
You should know that CATALINA_HOME/conf/web.xml (or CATALINA_BASE/conf/web.xml if you have one) is the default configuration for all web applications deployed on Tomcat and that your webapp's WEB-INF/web.xml is the configuration specific for your own web application. Both of these files should have the following xmlns statements and therefore indicate to you (by their URIs) that they are covered by the Java Servlet Specification (or at least Java EE, which includes the servlet spec):
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
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"
version="3.0">

Regex filter for mule requester to define relative resource name

When a inbound-endpoint file is received, mule lets us define a regex filter to determine if it's the right file.
<file:inbound-endpoint responseTimeout="10000" doc:name="File" path="${Inbound_Path}" pollingFrequency="${PollingFrequency}" connector-ref="nameConnector">
<file:filename-regex-filter pattern="BOB\d+\.FILE" caseSensitive="true"/>
</file:inbound-endpoint>
Is there a similar function or method where we can do the same thing with the mule requester method. We need to import a file in the middle of our flow process, but the file name is not specifically defined. See below for an example for what I am trying to do.
<mulerequester:request config-ref="muleRequesterConfig" resource="file://${Inbound_Path}/<want to add a regex to define the relative file name>?connector=nameConnector" doc:name="Mule Requester"/>
Basically, we do not know the exact file name because the inbound file gets time stamped every time it is stored into the file system. This makes it hard to provide a specific file address to the mule application.
Does anybody know if we can use some similar regex filter function that mirrors the capability of the file:filename-regex-filter for mule requester.
Update - Per Anton's response, I did the following.
Created the file:endpoint element outside of the flow.
<file:endpoint doc:name="File" name="File_Name" path="Inbound_Path" responseTimeout="10000" connector-ref="FileConnector">
<file:filename-regex-filter pattern="BOB\d+\.FILE" caseSensitive="true"/>
</file:endpoint>
Had the resource attribute reference the file:endpoint element
<mulerequester:request config-ref="muleRequesterConfig" resource="File_Name" doc:name="Mule Requester"/>
You can use a file:endpoint as the resource for mulerequester:request. Just resource="myFileEndpointName".

Cannot find CFML template for custom tag

I am not a ColdFusion coder. Doing a favor for a friend who ported his CF site from a Windows server to Unix on GoDaddy.
Site is displaying error:
Cannot find CFML template for custom tag jstk. ColdFusion
attempted looking in the tree of installed custom tags but did not
find a custom tag with this name.
The site as I found it has at document root /CustomTags with the jstk.cfm file and a set of files in cf_jstk
My Googling located this:
You must store custom tag pages in any one of the following:
The same directory as the calling page;
The cfusion\CustomTags directory;
A subdirectory of the cfusion\CustomTags directory;
A directory that you specify in the ColdFusion Administrator
So I have:
Tried creating placing /CustomTags in /cfusion/CustomTags
Tried copying /cfusion/CustomTags to above document root
Tried copying jstk.cfm and subfolders into same directory as calling file(index.cfm)
Update: Per GoDaddy support I have also tried adding the following to no effect: <cfmodule template="CustomTags/jstk.cfm">
Can any one give me some tips on this or should I just tell my guy to look for a CF coder?
Thanks!
I don't know how GoDaddy is setup, so as a quick test, please do the following:
Create file test.cfm in the webroot with contents:
<cf_testtag/>
<cfoutput>test</cfoutput><cfabort/>
Create file testtag.cfm in the webroot with contents:
<cfdump var=#ThisTag# />
Then in a browser visit the test.cfm page.
You should get two debug dumps, followed by the 'test'; this will confirm that custom tags in general are working.
If that works move the testtag.cfm to the CustomTags directory, and see if you get the same behaviour or an error.
If this produces an error, for CF8 and above, you can add <cfset This.CustomTagPaths = "/CustomTags" /> inside the Application.cfc file (assuming there is a App cfc and not an Application.cfm) to ensure that directory is checked for tags.
It is possible to convert Application.cfm to Application.cfc - how easy this is depends on how complex the code is in there - might be something you could figure out, or might need an experienced CF dev, it depends.
Depending on the outcome of this, we can attempt to debug why the jstk tag isn't working (unless one of the above solves it).
In an effort to check the simple things before worrying about complex things:
Remember that filenames on *nix systems are case sensitive, but on windows are not.
For example, a windows server will pick up "application.cfm" but a linux server won't. It requires "Application.cfm".
Check to make sure all filenames/paths are the correct case.
Normally, CFML check every custom tags in current directory first, if not found, second is in CFMX8/customtags/.