Is there a syslog private enterprise number for custom/internal use? - syslog

So I recently was looking for a way to add extra metadata to logs and found out that syslog got me covered. I can add custom metadata using SD-ID feature like this:
[meta#1234 project="project-name" version="1.0.0-RC5" environment="staging" user="somebody#example.com"]
The problem is that 1234 has to be a syslog private enterprise number.
I assume those are given to big companies like microsoft or apple, but not to indie developers.
So My question is, is there a reserved number for internal use that everyone could use without registration for internal purpose?

If you use RFC5424-formatted messages, you can (or could) create custom fields in the SDATA (Structured Data) part of the message.
The latter part of a custom field in the SDATA is, as you mentioned, the private enterprise number (or enterpiseId).
As per RFC5424 defined:
7.2.2. enterpriseId
The "enterpriseId" parameter MUST be a 'SMI Network Management Private Enterprise Code', maintained by IANA, whose prefix is iso.org.dod.internet.private.enterprise (1.3.6.1.4.1). The number that follows MUST be unique and MUST be registered with IANA as per RFC 2578 [RFC2578].
Of course it depends on what you're using it for, if it's only for local logs, you can use any enterpriseId or you can even use a predefined SDATA field with a reserved SD-ID and rewrite it's value. (See: syslog-ng Guide)

Related

Identify from which location cosmosdb query ran against

I am currently using CosmosClient V3. I am trying to figure out which region I am querying against when I have multi region setup. Previously, in V2 (DocumentClient) we were able to do it using connectionPolicy.PreferredLocations where we will be setting the preferred location and using client.ReadEndpoint we will able to verify the current read endpoint chosen based on availability.
But in V3 I am able to set the preferred location using ApplicationRegion/LimitToEndpoint, but there is no option to validate the which region the SDK choose for the query like client.ReadEndpoint. Is there any equivalent options available in SDK V3(CosmosClient).
You don't need to use LimitToEndpoint. As per the comment on that property:
When the value of this property is false, the SDK will automatically discover write and read regions, and use them when the configured application region is not available.
When set to true, availability is limited to the endpoint specified on the CosmosClient constructor.
Defining the ApplicationRegion is not allowed when setting the value to true.
You need to set the ApplicationRegion, which will make the SDK connect to the closest endpoint based on the account's regions. If your account has one of the regions matching the one the application is in, then it will use that one, otherwise, it will pick the closest one.
You can check the Diagnostics in the query FeedResponse to see which was the region used (please update to the latest SDK).

not able to whielist a class in corda 4?

Hi I used this example https://docs.corda.net/serialization.html#whitelisting to whitelist a java.sql.timestamp class manually but still I get this error:
"No unique deserialisation constructor found for class class java.sql.Timestamp, type is marked as non-composable
E 10:05:59 80 SerializationOutput.log - Serialization failed direction="Serialize", type="java.sql.Timestamp", msg="Class "class java.sql.Timestamp" is not on the whitelist or annotated with #CordaSerializable.", ClassChain="java.util.List<*> -> java.sql.Timestamp"
E 10:05:59 80 RestController.createIOU - Class "class java.sql.Timestamp" is not on the whitelist or annotated with #CordaSerializable"
here is my whitelist code:
class TradingAppSerializationWhitelist : SerializationWhitelist {
// Add classes like this.
override val whitelist = listOf(Timestamp::class.java)
}
For such a type, you would need to write a custom serialiser, not just whitelist the type.
However, may I ask why you want to use that type specifically? It’s more conventional to use java.time.Instant to record times on ledger when you need a time to machine precision, or the other types like java.time.LocalDateTime to record a time to human levels of precision (e.g. “8pm Tuesday” when no time zone is specified)
If you have data that’s starting from java.sql.Timestamp it’d be better to convert to an Instant, as that type has a much better design.
Additionally, timestamps are included within transactions by default. See the answer to this question to see how In Corda, how to get the timestamp of when a transaction happened?

Add custom text to AX 2012 drill-down links

I want to customize the standard drill-down functionality and add a text parameter to the drill-down URL. I will then parse and use the parameter in the SysStartUpCmdDrillDown or EventDrillDownPoller class like the solution provided by Jan B. Kjeldsen in this question.
The standard drill-down link is dynamics://Target/?DrillDown_RecID/ :
dynamics://0/?DrillDown_5637230378/
In previous versions of AX it was possible to modify the RecId to custom text and parse the text once the client is started:
dynamics://0/?DrillDown_0MenuItemName=PurchTable&FieldName=PurchId&FieldValue=P000044
Unfortunately, in AX 2012 the RecId is checked before the client is started and if it is not a valid int64, the drill-down event is not sent to the client. Since it is not possible to change the RecId to anything other than an integer, #Alex Kwitny suggested in the comments at that same question that you can add the custom text to the drill-down target like this:
dynamics://0MenuItemName=PurchTable/?DrillDown_5637230378/
The problem I experience with this is that the link now gets confused about which instance to start.
If the target is equal to the value in the System Admin -> system parameters -> Alerts ->Drill-down target, a client with the correct server instance is started. When I append the text with my custom text, it always starts the default instance(Which could be different from the instance I intended to start). While this is not ideal, I could work around this issue.
The bigger problem is that it now always starts a new session of the default instance, even if a client session is already started. As far as I can see I cannot write X++ code to solve this issue since the server instance is determined before any code in the client is executed.
My question is this - How can I add custom text to the drill-down link while preserving the way the client instance is started: If a client for the instance is already open, it should process the link in the open client, and not start up a new client of the default instance.
You should probably come up with another solution as mentioned in this post, but there could still be a way.
The URL has two objects that can be modified:
dynamics://[Drill-down target(str)]/?Drilldown_[Int64]
According to you, if you modify the [Drill-down target], then it launches AX using the default client config, and that is behavior that you don't want. If you have a matching [Drill-down target], it'll launch in the open client window, which is behavior I can't confirm, but I'll take it at face value and assume you're correct.
So that means the only thing you can modify in the URL is [int64]. This is actually a string that is converted to an int64 via str2int64(...), which in turn corresponds to a RecId. This is where it gets interesting.
This work all happens in \Classes\SysStartUpCmdDrillDown\infoRun.
Well, lucky for you the ranges for the objects are:
RecId - 0 to 9223372036854775807
Int64 - -9223372036854775808 to 9223372036854775807
You can call minRecId() and maxRecId() to confirm this.
So this means you have -9223372036854775808 to -1 numbers to work with by calling URLs in this range:
dynamics://0/?DrillDown_-1
to
dynamics://0/?DrillDown_-9223372036854775808
Then you would modify \Classes\SysStartUpCmdDrillDown\infoRun to look for negative numbers, and fork to your custom code.
HOW you decide to user these negative #'s is up to you. You can have the first n-digits be a table id or a look-up value for a custom table. You can't technically use a RecId as part of that negative number because in theory the RecId could get up that high (minus 1).

/alfresco/api/service/people only returns 5000 results in Alfresco EE 4.1.4

I've run into a problem where a call to https://localhost:8080/alfresco/service/api/people is only returning the first 5000 users.
I can't figure out how to get the rest out of the system--that API doesn't appear to support a "skipCount" argument.
I thought that I might be able to get at least a list of the usernames by using the WebDAV URL (https://localhost:8080/alfresco/webdav/User%20Homes/) to get the list, but that also only returns the first 5000.
So, how do I get the list of users from 5001 onwards?
there is a maxResult param you can give.
for e.g. https://localhost:8080/alfresco/service/api/people?filter=*&maxResults=10000
If you look at this JIRA ticket, you'll see that when you supply a * in the query it will search through SOLR and when you don't it'll search the DB.
If you look at the JAVA code beneath:
public PagingResults<PersonInfo> getPeople(String pattern, List<QName> filterStringProps, List<Pair<QName, Boolean>> sortProps, PagingRequest pagingRequest)
{
ParameterCheck.mandatory("pagingRequest", pagingRequest);
There is a PagingRequest which you can supply, so you could page that you need the rows/results after 5000.
Still you'd need to make a Java-Backend Webscript which retrieves the result.
---UPDATE---
In the org.alfresco.repo.jscript.People there is a maxResult:
private int defaultListMaxResults = 5000;
If you look a bit further then this class is initiated in the script-service-context.xml.
So just override the bean peopleScript and set the defaultListMaxResults to a higher nr, restart Alfresco and it should work.

Core Service 2011 - Address books

Is it possible to create Audience Manager Address Books using the Core Service (Tridion 2011 SP1)?
(Or automate creating them in any other way - db script, Interop?)
Cheers
There is no Audience Manager functionality in the Core Service; only Content Manager functionality is exposed there.
You can, however, use the public API (Tridion.AudienceManagement.API) on the server to create any item you want. You didn't specify the kind of Address Book you want to create - but I'm going to assume you want a static one to create Contacts in.
Here is some sample code to do that:
StaticAddressBook denmark = new StaticAddressBook();
denmark.Title = "Denmark";
denmark.Key = "DK";
denmark.Save();
If you want to create a Dynamic Address Book instead, you'll need to specify a filter too; let me know if that's the case and I can provide some sample code for that too.
You can use the Tridion.OutboundEmail.ContentManagement namespace. In there is an AddressBook object (or you can use StaticAddressBook depending on the type of AB you want to create). Something like this should work:
AddressBook ab = new AddressBook();
ab.Title = "The title of my new Address Book";
ab.Save();
Looking at the API for StaticAddressBook (it's documented) there's a static method StaticAddressBook.CreateLocalAddressBook that might actually be more relevant in this instance. I'd check it out if I were you ;) You can download the docs from SDLTridionWorld.com

Resources