I wanted to know if there is a way that I can write ELMAH to filter out error logging under the following logic:
If the error is a 404 on favicon.ico OR the error is 404 on /1.xml OR the error is 404 on /2.xml
I have found the way to just do it on the favicon.ico as shown:
<errorFilter>
<test>
<and>
<equal binding="HttpStatusCode" value="404" type="Int32" />
<regex binding="Context.Request.ServerVariables['URL']" pattern="/favicon\.ico(\z|\?)" />
</and>
</test>
</errorFilter>
But for some reason, I cannot understand how to do it for the OR conditions. Any help will be much appreciated.
The following should do the trick or otherwise get you started:
<errorFilter>
<test>
<and>
<equal binding="HttpStatusCode" value="404" type="Int32" />
<or>
<regex binding="Context.Request.ServerVariables['URL']"
pattern="/favicon\.ico(\z|\?)" />
<regex binding="Context.Request.ServerVariables['URL']"
pattern="/[1-2]\.xml(\z|\?)" />
</or>
</and>
</test>
</errorFilter>
Basically, this will filter errors where the HTTP status code is 404 and one of the regular expressions patterns grouped under the or element match the request URL.
Related
I am not a techie but have assumed some responsibilities in someone's absence.
Trying to push below Consent FHIR Resource:
<Consent xmlns="http://hl7.org/fhir">
<id value="123" />
<status value="inactive" />
<scope>
<coding>
<system value="http://terminology.hl7.org/CodeSystem/consentscope" />
<code value="patient-privacy" />
</coding>
</scope>
<category>
<coding>
<system value="http://loinc.org" />
<code value="59284-0" />
</coding>
</category>
<patient>
<reference value="Patient/41" />
<display value="John Stifiles" />
</patient>
<policyRule>
<coding>
<system value="http://terminology.hl7.org/CodeSystem/consentpolicycodes" />
<code value="cric" />
</coding>
</policyRule>
<provision>
<type value="deny" />
<period>
<start value="2021-09-27" />
<end value="2021-09-27" />
</period>
</provision>
</Consent>
This is passed with no errors from inferno.healthit.gov/validator/ but when I run through my integrator (it hits HL7 validator), I get a variety of errors - Encountered unknown member 'Scope' or Encountered unknown member 'Patient', etc.
This is a Consent resource that conforms to FHIR version R4. Inferno runs FHIR R4 as well, so that works.
However, if you try and validate this resource against FHIR STU3, you will get the errors you mentioned, since the Consent resource structure significantly changed from STU3 to R4. Please check your integrator and make sure it runs FHIR R4 as well.
So I have a valid xml file looking something like this:
<session xmlns="http://winscp.net/schema/session/1.0" name="mysession#10.0.0.22" start="2015-09-28T05:00:01.974Z">
<ls>
<destination value="/" />
<files>
<file>
<filename value="." />
<type value="d" />
<modification value="2015-09-28T05:44:14.000Z" />
<permissions value="rw-rw----" />
</file>
<file>
<filename value=".." />
<type value="d" />
<modification value="2015-09-28T05:44:14.000Z" />
<permissions value="rw-rw----" />
</file>
<file>
<filename value="55800379_150928_071525.zip" />
<type value="-" />
<size value="999124" />
<modification value="2015-09-28T05:36:08.000Z" />
<permissions value="rw-rw----" />
</file>
</files>
<result success="true" />
</ls>
<download>
<filename value="/55800379_150928_071525.zip" />
<destination value="C:\somefolder\55800478_150928_071525.zip" />
<result success="true" />
</download>
<rm>
<filename value="/55800379_150928_071525.zip" />
<result success="true" />
</rm>
</session>
I have added it as data in splunk and am trying to search using a query as below:
source="sample5.xml" host="dummy1" sourcetype="WinSCP XML" | xpath outfield=afield "//ls/files/file/filename/#value"
However, in this case the afield field is not getting populated (I was expecting the three values '.', '..' and '55800379_150928_071525.zip'). So I've got the error down to the xmlns in the session tag, when the first line looks like this (note: no xmlns attribute), the search does what I expect:
<session name="mysession#10.0.0.22" start="2015-09-28T05:00:01.974Z">
What do I have to put in my xpath to get the result I am looking for (I would very much prefer not to have to preprocess my logs to remove the XML namespace prior to import)?
Hmm, that looks like an unnamed namespace, which I can get at by registering a custom namespace prefix using my libxml2 wrapper program:
$ xpquery -n 'x:http://winscp.net/schema/session/1.0' '//x:ls/x:files/x:file/x:filename/#value' blah.xml
value="."
value=".."
value="55800379_150928_071525.zip"
$
Check whether your xpath program has support for the equivalent of libxml2 registerNs functionality?
I want to extract information from the jms-bus node. Specifically the busid,
//[local-name()='jms-bus'][#busid=//[local-name()='jms-listener']/#busidref]/#busid matches perfectly and returns quickstartGwChannel and quickstartESBChannel if the have matching providers and services.
However, I want to return the jms-bus(s) where it has a jms-listener is-gateway='true'
I am not sure where to put the 'and' clause. When I put it at the beginning //*[local-name()='jms-listener]/[#is-gateway='true']and .... it returns a boolean.
I need to extract from this xml
<providers>
<jms-provider name="JBossMQ" connection-factory="ConnectionFactory">
<jms-bus busid="quickstartGwChannel">
<jms-message-filter
dest-type="QUEUE"
dest-name="queue/quickstart_helloworld_Request_gw"
/>
</jms-bus>
<jms-bus busid="quickstartEsbChannel">
<jms-message-filter
dest-type="QUEUE"
dest-name="queue/quickstart_helloworld_Request_esb"
/>
</jms-bus>
</jms-provider>
</providers>
<services>
<service
category="FirstServiceESB"
name="SimpleListener"
description="Hello World">
<listeners>
<jms-listener name="JMS-Gateway"
busidref="quickstartGwChannel"
is-gateway="true"
/>
<jms-listener name="helloWorld"
busidref="X12"
is-gateway="false"
/>
</listeners>
<actions mep="OneWay">
<action name="action1"
class="org.jboss.soa.esb.samples.quickstart.helloworld.MyJMSListenerAction"
process="displayMessage"
/>
<action name="action2" class="org.jboss.soa.esb.actions.SystemPrintln">
<property name="printfull" value="false"/>
</action>
<!-- The next action is for Continuous Integration testing -->
<action name="testStore" class="org.jboss.soa.esb.actions.TestMessageStore"/>
</actions>
</service>
</services>
Something like this:
//*[local-name()='jms-bus']
[#busid=//*[local-name()='jms-listener']
[#is-gateway='true']/#busidref]/#busid
or
//*[local-name()='jms-bus']
[#busid=//*[local-name()='jms-listener' and #is-gateway='true']/#busidref]/#busid
I have to return a certain node that is a sibling to a node that I am using to select a certain parent of both nodes...
suppose...
<?xml version="1.0" encoding="utf-16"?>
<dataTemplateSpecification id="id1" name="name1">
<templates xmlns="">
<template>
<elements>
<element id="element0" name="PatientId" display="Patient ID" dataType="String" visable="true" readOnly="false" value="32">
<mapping path="//Template/TemplateData/ACOData/PATIENT_ID" />
<validation>
<rules>
<rule id="r0" test="#element0.value == ''">
<fail>
<html>
<b>Patient ID is null, value must be present</b>
</html>
</fail>
</rule>
</rules>
</validation>
</element>
<element id="element4" name="Active" display="ACTIVE" dataType="String" visable="true" readOnly="true" value="A">
<mapping path="//Template/TemplateData/ACOData/ACTIVE" />
<!--//Templates/Patient/sources/source/empi"/>-->
<validation>
<rules>
<rule id="r1" test="#element1.value == ''">
<fail>
<html>
<b>EMPI ID is null, value must be present</b>
</html>
</fail>
</rule>
</rules>
</validation>
</element>
<element id="element2" name="PopulationPatientID" display="Population Patient ID" dataType="String" visable="true" readOnly="true" enc="223" value="198">
<mapping path="//Template/TemplateData/ACOData/POPULATION_PATIENT_ID" />
<!--Patient/compositeID[./idType='populationPatientID']/id-->
<validation>
<rules>
<rule id="r1" test="#element1.value == ''">
<fail>
<html>
<b>EMPI ID is null, value must be present</b>
</html>
</fail>
</rule>
</rules>
</validation>
</element>
<element id="element1" name="EncounterId" display="Encounter ID" dataType="String" visable="true" readOnly="false" value="223">
<mapping path="//Template/TemplateData/ACOData/FOCUSED_READMISSIONS_ID" />
<validation>
<rules>
<rule id="r0" test="#element0.value == ''">
<fail>
<html>
<b>Patient ID is null, value must be present</b>
</html>
</fail>
</rule>
</rules>
</validation>
</element>
The Xpath I have right now currently only gets the right template. But I need the right element...
//dataTemplateSpecification/templates/template[./elements/element[#name="PopulationPatientID" and #value="198" and #enc="223"]]
I need to xpath to the node that has an attribute named "Active" Is that even possible? I was thinking I might need to drill backwords in the [] section... you know [./../../] where I would be selecting by a finer granularity before then... //dataTemplateSpecification/templates/template/elements/element[./../../] ect.. Does that make sense or am I completely rambling here? Any help would be appreciated. Thanks.
The reason you are getting the template instead of the element with your XPath search is because you are searching for template.
//dataTemplateSpecification/templates/template[./elements/element[#name="PopulationPatientID" and #value="198" and #enc="223"]]
If you want the element instead, you need to specify it before the predicate part of the XPath statement (the predicate being the part in [ ] or brackets).
Also, if you are looking for the element with the name attribute that has a value of "Active", you can specify it as part of your XPath statement.
Either one of the following statements will get the element with that has a name of "Active":
/dataTemplateSpecification/templates/template/elements/element[#name = 'Active']
//element[#name = 'Active']
Use:
/*/*/*/*/element
[#name="PopulationPatientID" and #value="198" and #enc="223"]
/preceding-sibling::element[1]
or even simpler:
/*/*/*/*/element[#name='Active']
#royerboat and #Dimitre Novatchev...
both of you guys had the right idea and it inspired me to get the Xpath that I needed...
//dataTemplateSpecification/templates/template[./elements/element[#name="PopulationPatientID" and #value="198" and #enc="223"]]//element[#name = 'Active']
That xpath is precisely what I need. Dimitre, I tried both of your sugestions and they came close, but no cigar. Thanks for the help guys.
I've got a custom section in my web.config file similar to this structure:
<Messages>
<Message id="1'>
<Property Name="foo" value="bar" />
</Message>
<Message id="2'>
<Property Name="foo" value="bar2" />
</Message>
</Messages>
I want to apply a custom transformation on this such that I can change the value of ALL instances of the Property element with Name="foo" - but I cant seem to get it to work.
I've tried:
<Messages>
<Message>
<Property Name="foo" value="updated" xdt:Locator=Match(Name) xdt:Transform="Replace" />
</Message>
</Mesasges>
I can remove all the elements by replacing the Transform=Replace with a Transform=RemoveAll - any ideas how I can achieve something similar to replace all the values?
It seems like Transform:Replace only replaces the first matched element from the documentation on msdn: ...If more than one element is selected, only the first selected element is replaced. I solved this issue by using a combination of Match-Conditions and SetAttributes, something like:
<Messages>
<Message>
<Property value="updated" xdt:Locator=Condition(#Name='foo') xdt:Transform="SetAttributes(value)" />
</Message>
</Messages>