How to set current time (-zone) for Logging? - elasticsearch

I use for logging Microsoft.Extensions.Logging and NLog. The logs are written to Elasticsearch. When I look up my logs using Kibana all my logs are written at UT what means two houers different to my local time (-zone) MET. I would like to see my logs with my local time at Kibana. How can I adjust the time zone for logging?
I add the NLog.config:
<nlog autoReload="true" throwExceptions="false"
internalLogLevel="Info" internalLogFile="NLogError.log"
xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="Logfile" xsi:type="File"
fileName="${basedir}dap.log"
layout="${longdate} ${level} ${callsite} -> ${message} ${exception:format=Message,StackTrace}"
archiveFileName="${basedir}/archives/log.{#}.log"
archiveEvery="Day"
archiveNumbering="Rolling"
maxArchiveFiles="14"
keepFileOpen="false"
/>
<target xsi:type="Network"
name="CentralLog"
newLine ="false"
maxMessageSize="65000"
connectionCacheSize="5"
encoding="utf-8"
keepConnection="false"
maxQueueSize="100"
address="tcp://myurl.org:5544"
onOverflow="Split">
<layout type="JsonLayout">
<attribute name="machinename" layout="${machinename}" />
<attribute name="level" layout="${level:upperCase=true}" />
<attribute name="processname" layout="${processname}" />
<attribute name="processid" layout="${processid}" />
<attribute name="sendertimestamp" layout="${date:universalTime=true:format=yyyy-MM-ddTHH\:mm\:ss.fff}" />
<attribute name="module" layout="dhp DataPickerApi ${logger}" />
<attribute name="message" layout="${message}" />
<attribute name="exception" layout="${exception}" />
<attribute name="activityId" layout="${activityId}" />
</layout>
</target>
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="Logfile" />
<logger name="*" minlevel="Trace" writeTo="CentralLog"/>
</rules>
</nlog>

Don't use universalTime=true?
So instead of this:
<attribute name="sendertimestamp"
layout="${date:universalTime=true:format=yyyy-MM-ddTHH\:mm\:ss.fff}" />
Use this:
<attribute name="sendertimestamp"
layout="${date:format=yyyy-MM-ddTHH\:mm\:ss.fff}" />

You can set the timezone in the Kibana web.
Setting-->Advanced---> DateFormat:tz
to get more info : https://www.elastic.co/guide/en/kibana/current/advanced-options.html

Related

How to recover the deleted the “Quick Find View”. in MS Dynamics CRM

IF you delete the Quick Find View of an Entity,
How to recover it please follow the below instructions
Solution:
First create a view and get his GUID, save in notepad, and delete the
view.
Create a solution, Import the selected entity from which you
deleted the “Quick Find View” and Export it. Open Customization.xml and add the XML to the following path.
XML Path : ImportExportXml/Entities/Entity/SavedQueries
<savedquery>
<IsCustomizable>1</IsCustomizable>
<CanBeDeleted>0</CanBeDeleted>
<isquickfindquery>1</isquickfindquery>
<isprivate>0</isprivate>
<isdefault>1</isdefault>
<returnedtypecode>Entitytypecode</returnedtypecode>
<savedqueryid>View Guid</savedqueryid>
<layoutxml>
<grid name="resultset" object=" Entitytypecode " jump="FieldName" select="1" icon="1" preview="1">
<row name="result" id="Entity Primary Key ">
<cell name="name" width="300" />
<cell name="createdon" width="125" />
</row>
</grid>
</layoutxml>
<querytype>4</querytype>
<fetchxml>
<fetch version="1.0" mapping="logical">
<entity name="Entity Name">
<attribute name="Entity Primary Key" />
<attribute name="name" />
<attribute name="createdon" />
<filter type="and">
<condition attribute="statecode" operator="eq" value="0" />
</filter>
<filter type="or" isquickfindfields="1">
<condition attribute="name" operator="like" value="{0}" />
</filter>
</entity>
</fetch>
</fetchxml>
<IntroducedVersion>1.0</IntroducedVersion>
<LocalizedNames>
<LocalizedName description="Quick Find Active" languagecode="1033" />
</LocalizedNames>
</savedquery>
Save the file.
Upload the Solution and Publish it.

Request URL Too Long for fetchXml query types

I'm using CRM 2016 web api with fetchxml query parameter, but my query is too long it's simulate the IN operator were the number of parameters passed in the IN list are 300 elements and some times will be more than that.
So my problem is the query are too big for a GET HTTP Request. I have tried to send the query in the http message body but that didn't work so what is the solution for this problem?
Here's a code snippet of the fetchxml query that I used:
<fetch mapping="logical" distinct="true">
<entity name="entity">
<attribute name="new_classopportunityid" />
<attribute name="new_trainingproduct" />
<attribute name="new_gtgstatus" />
<attribute name="new_scheduledstartdate" />
<attribute name="new_scheduledenddate" />
<attribute name="new_remainingnumberofseats" />
<attribute name="new_liveclassroom" />
<attribute name="new_maxlive" />
<attribute name="new_xavieruniversity" />
<attribute name="new_partnerlive" />
<attribute name="new_blended" />
<filter>
<condition attribute="new_classopportunityid" operator="in">
<value>001943ea-e263-e611-8158-00155d002810</value>
<value>0071e4ea-bd9b-e611-8163-00155d002810</value>
<value>00c32774-1c8f-e611-8161-00155d002810</value>
<value>00d513fa-f0bb-e611-8169-00155d002810</value>
<value>....</value>
<value>....</value>
<value>....</value>
</condition>
</filter>
</entity>
</fetch>
The CRM web api endpoint that I request is :
GET http://<org>/api/data/v8.0/<entity>?fetchXml=<fetch mapping="logical" distinct="true">
<entity name="entity">
<attribute name="new_classopportunityid" />
<attribute name="new_trainingproduct" />
<attribute name="new_gtgstatus" />
<attribute name="new_scheduledstartdate" />
<attribute name="new_scheduledenddate" />
<attribute name="new_remainingnumberofseats" />
<attribute name="new_liveclassroom" />
<attribute name="new_maxlive" />
<attribute name="new_xavieruniversity" />
<attribute name="new_partnerlive" />
<attribute name="new_blended" />
<filter>
<condition attribute="new_classopportunityid" operator="in">
<value>001943ea-e263-e611-8158-00155d002810</value>
<value>0071e4ea-bd9b-e611-8163-00155d002810</value>
<value>00c32774-1c8f-e611-8161-00155d002810</value>
<value>00d513fa-f0bb-e611-8169-00155d002810</value>
<value>....</value>
<value>....</value>
<value>....</value>
</condition>
</filter>
</entity>
</fetch>
This is the response I got from the api.
Error code: 414: HTTP/1.1 414 Request-URI Too Long Response : "<!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.01\/\/EN\"\"http:\/\/www.w3.org\/TR\/html4\/strict.dtd\">\r\n<HTML><HEAD><TITLE>Request URL Too Long<\/TITLE>\r\n<META HTTP-EQUIV=\"Content-Type\" Content=\"text\/html; charset=us-ascii\"><\/HEAD>\r\n<BODY><h2>Request URL Too Long<\/h2>\r\n<hr><p>HTTP Error 414. The request URL is too long.<\/p>\r\n<\/BODY><\/HTML>\r\n" [] []
You'll need to use a Post, not a Get:
https://dreamingincrm.com/2017/01/15/executing-large-fetchxml-with-webapi/
Using the "in" operator with a big list of ids is probably not the best way to query, as you've seen. It would be better if you could filter on an attribute of the new_classopportunity entity by using a link-entity, like this:
<fetch mapping="logical" distinct="true" >
<entity name="entity" >
<!-- ... all your attributes ... -->
<link-entity name="new_classopportunity" from="new_classopportunityid" to="new_classopportunityid" >
<attribute name="new_name" />
<filter>
<condition attribute="statecode" operator="eq" value="0" />
</filter>
</link-entity>
</entity>
</fetch>
Notice you can pull in attributes from the link-entity as well. In this case I'm pulling in name and using a filter to only get new_classopportunity records that are active.
If you don't have a field on new_classopportunity that you can filter on to get the same list, add one! :)

Where can i find VMARGS in IBM WAS 8.5

I have installed IBM WAS 8.5 During startup I can see in the console
<?xml version="1.0" ?>
<verbosegc xmlns="http://www.ibm.com/j9/verbosegc" version="R26_Java626_SR2_20120322_1722_B106210_CMPRSS">
<initialized id="1" timestamp="2016-07-26T11:55:01.392">
<attribute name="gcPolicy" value="-Xgcpolicy:gencon" />
<attribute name="maxHeapSize" value="0x60000000" />
<attribute name="initialHeapSize" value="0x60000000" />
<attribute name="compressedRefs" value="true" />
<attribute name="compressedRefsDisplacement" value="0x0" />
<attribute name="compressedRefsShift" value="0x0" />
<attribute name="pageSize" value="0x1000" />
<attribute name="requestedPageSize" value="0x1000" />
<attribute name="gcthreads" value="12" />
<attribute name="numaNodes" value="0" />
<system>
<attribute name="physicalMemory" value="17100500992" />
<attribute name="numCPUs" value="12" />
<attribute name="architecture" value="amd64" />
<attribute name="os" value="Windows 7" />
<attribute name="osVersion" value="6.1" />
</system>
<vmargs>
<vmarg name="-Xoptionsfile=C:\Program Files (x86)\IBM\WebSphere\AppServer\java\jre\bin\compressedrefs\options.default" />
<vmarg name="-Xlockword:mode=default,noLockword=java/lang/String,noLockword=java/util/MapEntry,noLockword=java/util/HashMap$Entry,noLockword..." />
<vmarg name="-Xlockword:noLockword=java/lang/invoke/MethodType" />
<vmarg name="-Xlockword:noLockword=java/lang/invoke/MethodHandle" />
<vmarg name="-Xlockword:noLockword=java/lang/invoke/CollectHandle" />
<vmarg name="-Xlockword:noLockword=java/lang/invoke/ConstructorHandle" />
<vmarg name="-Xlockword:noLockword=java/lang/invoke/ConvertHandle" />
<vmarg name="-Xlockword:noLockword=java/lang/invoke/ArgumentConversionHandle" />
<vmarg name="-Xlockword:noLockword=java/lang/invoke/AsTypeHandle" />
<vmarg name="-Xlockword:noLockword=java/lang/invoke/ExplicitCastHandle" />
<vmarg name="-Xlockword:noLockword=ja
….rest is removed for brevity.
Where these vmargs are set and in which file ? I need to edit one of vmarg.
Thanks Scott.I got in to an issue like below.
There is missing ‘=’ i.e equal sign between the key and value
…..
<vmarg name="-Djava.security.auth.login.config=C:\Program Files (x86)\IBM\WebSphere\AppServer\profiles\EbodsMavenSpringWS/properties/wsjaas...." />
<vmarg name="-Djava.security.policyC:\Program Files (x86)\IBM\WebSphere\AppServer\profiles\EbodsMavenSpringWS/properties/server.policy" /> <vmarg name="-Dsun.java.command=com.ibm.wsspi.bootstrap.WSPreLauncher -nosplash -application com.ibm.ws.bootstrap.WSLauncher com.ibm.ws.runt..." />
<vmarg name="-Dsun.java.launcher=SUN_STANDARD" />
<vmarg name="_port_library" value="000007FEF4267A40" />
<vmarg name="_bfu_java" value="000007FEF4268FD8" />
<vmarg name="_org.apache.harmony.vmi.portlib" value="00000000002C0930" />
</vmargs>
</initialized>
Insufficient Java 2 security permissions to start the process!
java.security.policy = null
CodeSource for bootstrap.jar = ProtectionDomain
CodeSource=CodeSource, url=file:/C:/Program%20Files%20(x86)/IBM/WebSphere/AppServer/lib/bootstrap.jar, <no certificates>
ClassLoader=sun.misc.Launcher$AppClassLoader#c630ab9f
<no principals>
The file you're looking for is server.xml. You can find this inside your configuration folder, at the following location.
C:\Program Files (x86)\IBM\WebSphere\AppServer\profiles\EbodsMavenSpringWS\config\cells\<CELL_NAME>\nodes\<NODE_NAME>\servers\<SERVER_NAME>\server.xml
Open up server.xml using a text editor, and find the 'jvmEntries' id. It should like the example given below.
<jvmEntries xmi:id="JavaVirtualMachine_1183122130078" verboseModeClass="false" verboseModeGarbageCollection="true" verboseModeJNI="false" initialHeapSize="1280" maximumHeapSize="2048" runHProf="false" hprofArguments="" debugMode="false" debugArgs="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7777" genericJvmArguments="-Xdisableexplicitgc -Djava.awt.headless=true">
</jvmEntries>
Your JVM arguments should be listed under the genericJvmArguments section. Modify the values and start the server.
Additional note: As you have installed WAS to the 'Program Files (x86)' folder, you will need an account with administrator privileges to run the server.

CRM Reports, Why,Some Address fields not populating?

I known this a broad question, I just cant get my head around it. I have created a report that pulls client details for a specific sales person. I get back clients with addresses and some without addresses , even though the address composite field has been filled out on CRM. There is no equation/expression that I have used to pull the address date. Just get the field and display. Can you help me , by giving me a few pointers on what to check/look out for in CRM .
UPDATE 1:
<fetch distinct="false" no-lock="false" mapping="logical">
<entity name="activitypointer" enableprefiltering="1" prefilterparametername="CRM_FilteredActivityPointer">
<attribute name="scheduledstart" alias="scheduledstart" />
<attribute name="subject" alias="subject" />
<attribute name="regardingobjectid" alias="regardingobjectid" />
<attribute name="description" alias="description" />
<attribute name="activityid" />
<attribute name="ownerid" alias="ownerid" />
<attribute name="activitytypecode" />
<attribute name="actualstart" alias="actualstart" />
<attribute name="actualdurationminutes" alias="actualdurationminutes" />
<attribute name="actualend" alias="actualend" />
<link-entity name="opportunity" to="regardingobjectid" from="opportunityid" link-type="outer" alias="LE_3c8631e7bcbe64b3de96e66789a47536">
<attribute name="customerid" alias="LE_3c8631e7bcbe64b3de96e66789a47536_customerid" />
<attribute name="schedulefollowup_qualify" alias="LE_ad91c354eb5a26b004de4d41b2c3d454_schedulefollowup_qualify" />
<attribute name="new_accounttype" alias="LE_54d761d89ac278139a6836de7c3607db_new_accounttype" />
<attribute name="new_neworexisiting" alias="LE_5db2d6da9e43bd44c8949cb912432cba_new_neworexisiting" />
<attribute name="new_accaddresscomposite" alias="LE_c6b3b5d2a9364c90878a5d147b97b866_new_accaddresscomposite" />
<attribute name="parentaccountid" alias="LE_b7d5c9432034544323d9170db9688778_parentaccountid" />
<attribute name="actualclosedate" alias="LE_3d1bcadc4e9010d6d4689ded2531d68a_actualclosedate" />
</link-entity>
<link-entity name="account" to="regardingobjectid" from="accountid" link-type="outer" alias="LE_d08b5ac0b1b1a422353a6d092b699986">
<attribute name="name" alias="LE_d08b5ac0b1b1a422353a6d092b699986_name" />
</link-entity>
<link-entity name="account" to="regardingobjectid" from="accountid" link-type="outer" alias="LE_b6831392115770835cce64e99a59be4a">
<attribute name="address1_composite" alias="LE_b6831392115770835cce64e99a59be4a_address1_composite" />
</link-entity>
<link-entity name="new_visit" to="regardingobjectid" from="new_visitid" link-type="outer" alias="LE_041a4de02adecc6816a3be5b9389d9ac">
<attribute name="new_tmpdurationmins" alias="LE_041a4de02adecc6816a3be5b9389d9ac_new_tmpdurationmins" />
</link-entity>
<link-entity name="new_visit" to="regardingobjectid" from="new_visitid" link-type="outer" alias="LE_0238625bc02c72e091b42d4c6ece34e5">
<attribute name="new_arriveddatetime" alias="LE_0238625bc02c72e091b42d4c6ece34e5_new_arriveddatetime" />
</link-entity>
</entity>
As a first tweak I'd suggest you merge those separate link-entity joins on account into one:
current joins on account:
<link-entity name="account" to="regardingobjectid" from="accountid" link-type="outer" alias="LE_d08b5ac0b1b1a422353a6d092b699986">
<attribute name="name" alias="LE_d08b5ac0b1b1a422353a6d092b699986_name" />
</link-entity>
<link-entity name="account" to="regardingobjectid" from="accountid" link-type="outer" alias="LE_b6831392115770835cce64e99a59be4a">
<attribute name="address1_composite" alias="LE_b6831392115770835cce64e99a59be4a_address1_composite" />
</link-entity>
proposed change:
<link-entity name="account" to="regardingobjectid" from="accountid" link-type="outer" alias="LE_d08b5ac0b1b1a422353a6d092b699986">
<attribute name="name" alias="LE_d08b5ac0b1b1a422353a6d092b699986_name" />
<!-- move the address1_composite field here -->
<attribute name="address1_composite" alias="LE_d08b5ac0b1b1a422353a6d092b699986_composite" />
</link-entity>
This should at least yield a consistent behavior for all account fields but it still leaves open if using activitypointer as the root entity for your report is the right way. It depends on your reports business logic/user story.
You could verify this by formulating the report in plain language: "For all Activities, show me ..." vs. "For all Opportunities, show me ..." vs. "For all Accounts, show me ..."
A great way to test your reports FetchXml query is using FetchXmlTester contained in Xrm Toolbox.

View Showing Accounts that don't have contact

I want to create two views.
- One view showing all accounts having contacts. It is easy. I don't have any issue with this.
- Second View Showing All Accounts don't have any contact.
As we can't specify such condition for second view in advance find. Is there any way we can achieve this using Views?
I don't want to create SSRS report or any custom Development.
Please let me know if this is achievable.
You can achieve this only by modifying the Account entity customization xml.
Create a new (system) view for Account and name it "Active Accounts without Contacts".
Create a (unmanaged) solution for export and add the Account entity without any dependencies.
Export the solution and unpack the zip archive.
Open the customization.xml with the editor of your choice.
Modify the views FetchXml as follows:
before
...
<fetchxml>
<fetch version="1.0" output-format="xml-platform" mapping="logical">
<entity name="account">
<attribute name="accountid" />
<order attribute="name" descending="false" />
</entity>
</fetch>
</fetchxml>
<IntroducedVersion>1.0.0.0</IntroducedVersion>
<LocalizedNames>
<LocalizedName description="Active Accounts without Contacts" languagecode="1033" />
</LocalizedNames>
<Descriptions>
<Description description="Active Accounts without Contacts" languagecode="1033" />
</Descriptions>
...
after
<fetchxml>
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
<entity name="account">
<attribute name="accountid" />
<order attribute="name" descending="false" />
<link-entity name="contact" from="parentcustomerid" to="accountid" link-type="outer"/>
<filter type="and">
<condition attribute="parentcustomerid" operator="null" />
</filter>
</entity>
</fetch>
</fetchxml>
<IntroducedVersion>1.0.0.0</IntroducedVersion>
<LocalizedNames>
<LocalizedName description="Active Accounts without Contacts" languagecode="1033" />
</LocalizedNames>
<Descriptions>
<Description description="Active Accounts without Contacts" languagecode="1033" />
</Descriptions>
...
Finally, re-package the solution, import and publish.
I could not get this to work, and after quite a bit of "tinkering" altered the fetchxml as follows and it works! I basically moved the filter to before the link-entity detail. This is on CRM2013 with Rollup 1.
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" >
<entity name="account" >
<attribute name="address1_city" />
<filter type="and" >
<condition entityname="contact" attribute="parentcustomerid" operator="null" />
</filter>
<link-entity name="contact" from="parentcustomerid" to="accountid" link-type="outer" />
<attribute name="primarycontactid" />
<order attribute="name" descending="false" />
<attribute name="telephone1" />
<attribute name="accountid" />
</entity>
</fetch>

Resources