Serilog - Aggregate/Hide Multiple identical log messages - serilog

it can happen that in a loop I the same message is logged for every item and the result is something like the screenshot below:
Is there a filter/sink/option in Serilog to display the first message (or the first X messages) and then something like:"and X more identical messages.."

Related

Quickfixj- Custom FIX msg - 35=F not working for Multileg

I am using quickfixJ 2.3
To parse the FIX message , we have used
MessageUtils.parse(msgFactory,dd,inPutFixMsg, false)
I am able to place the list order ,multileg - 35= AB, AC order.
Now when I want to cancel the multileg order created by AB,
I just replaced 35=F, added 41 tag.
Now I am getting error while parsing in Message.parse : tag 600 appears more than once.
I am interested to know ,the other cancel( new order cancel, future cancel) working fine. Even I have mentioned the dd, then still why m I getting the error?
Or is there any other approach ?
You can't just change the message type (tag 35) and assume all the other tags are going to be compatible!
AB and F messages have different tags in their body. They are totally different messages!
The amount of stuff about FIX that you need to know exceeds what is appropriate for a StackOverflow answer. You really need to read some docs about how FIX messages are structured and decoded.

Printing a Crystal Report directly to printer

I am creating a label printing function in a program that needs to create labels for the given information. I have created a label in Crystal Reports 9 but I'm having trouble printing it.
I don't want to save the label, I just want it to print directly after the system has created it.
Dim ap9 As craxdrt.Application
Dim rpt9 As craxdrt.Report
Dim dbt As craxdrt.DatabaseTable
Set ap9 = New craxdrt.Application
On Error GoTo errError2
Set iniFile = New CIniFile
On Error GoTo errError3
Set rpt9 = ap9.OpenReport(iniFile.pathReports & REPORT_LABEL_IN)
On Error GoTo errError4
For Each dbt In rpt9.Database.Tables
dbt.Location = iniFile.pathDbCosmet
If dbt.ConnectionProperties.count <= 5 Then
dbt.ConnectionProperties.Add "Database Password", iniFile.passwordCosmet
End If
Next
rpt9.RecordSelectionFormula = sFormula
rpt9.PrintOut False, CInt(txtPacksReceived.Text)
The following code allows me to select a printer
and after clicking 'Print' at that point I am shown another dialog
However, the code executes fine, there are no errors, but the print queue doesn't show any documents and the report doesn't print.
Is there some reason why I'm not able to print my labels?
I've had problems with Zebra printers in the past that all turned out to be driver related. Have you uninstalled the printer driver and reinstalled it? Otherwise try unplugging and removing the device, plugging it into a different port and trying again?
Most likely your report doesn't contain any data - some logical error in selection/suppression formulas or similar.
If you print to any other printer, does something print out? Tracing SQL (assuming your report is bound to SQL server), can you see issued query? Does it look correct?

Multiple times trigger generation in Zabbix

I am new to zabbix. I have a basic requirement of monitoring occurrence of different log messages using zabbix. Say, when there is a log message "server starting", zabbix should show that alert. The idea is that if the server (re)starts 10 times in last 10 minutes, the zabbix dashboard (or at any other place) should display that 10 times.
I have done the following for that :
Created an item under template MyTemplate:
Type : Zabbix Agent (Active)
key : log[/opt/mylog/logs/abc.log,server starting]
Type of information : Log
Update Interval (in sec) : 30
Created a trigger with expression :
{MyTemplate:log[/opt/mylog/logs/abc.log,server
starting].logeventid(1)}=0
With logeventid(1), I am seeing that the alert (trigger) is getting generated only once. It appears only once in the Dashboard --> Last 20 issues. If I go to Monitoring --> Trigger, I see the alert only once, although the log files have 10 entries of the message "server starting" (server restarted 10 times).
Then I set the trigger to following :
{MyTemplate:log[/opt/mylog/logs/abc.log,server
starting].nodata(300)}=0
Now, at Monitoring --> Trigger, I see the alert (trigger) 10 times, but, from the Dashboard --> Last 20 issues it vanishes just after 300 seconds.
My questions are :
What should be the trigger function, I should use? I want to see 10 alerts in zabbix if the same message appears 10 times in the log file within a period of time.
With nodata(300), why does the alert vanish after 300 sec?
Is it ok if I use 30 minutes instead of 300 seconds as an argument of nodata()?
Function logeventid() is normally used for Windows and VMware event logs. In this case, it should probably not be used and it is suspicious that it fires, which might indicate a bug in Zabbix.
Anyway, you can check "Multiple PROBLEM events generation" box in trigger configuration and the trigger will generate a new PROBLEM event every time the condition is true, regardless of its previous value. Instead of logeventid(), you can try using a function that is always true, for instance, strlen()>0.
If you wish the trigger to go into OK state after some time, say, 10 minutes, you can add nodata(10m). Then your trigger will look like this:
{MyTemplate:log[/opt/mylog/logs/abc.log,server starting].strlen()}>0 and
{MyTemplate:log[/opt/mylog/logs/abc.log,server starting].nodata(10m)}=0

How to prevent message from disappearing in a message subfile?

I have a RPG program A and a CL program B. A accepts some user input from display file and use it as the entry parameter of B. b processes the entry parameter, and if there is an error the message will be received and resent by B so that it will be displayed on the bottom of the display file using message subfile. This message displaying mechanism works but not completely, as the message sent could only be glanced in a very short period of time, then it disappeared from the display file. What would be the cause of this problem? How to stop the message from disappearing?
Here is the sample code inside program B:
DCLF FILE(ECSWIFP1)
MONMSG MSGID(CPF0000) EXEC(GOTO CMDLBL(ERROR))
OVRDBF FILE(ECSWIFP1) TOFILE(ECSWIFP1) SHARE(*YES)
OPNQRYF FILE(ECSWIFP1) QRYSLT(&QRYSTR)
RCVF
CLOF FILE(ECSWIFP1)
DLTOVR FILE(ECSWIFP1)
RTVDTAARA DTAARA(&E4LIBN/&E4OBJN) RTNVAR(&DTARVAL)
GOTO CMDLBL(END)
ERROR:
CLOF FILE(ECSWIFP1)
MONMSG MSGID(CPF4520)
DLTOVR FILE(ECSWIFP1)
MONMSG MSGID(CPF9841)
MSG:
RCVMSG MSGTYPE(*ANY) MSGDTA(&MSGDTA) MSGID(&MSGID)
IF COMD(%SST(&MSGID 1 3)) *NE 'CPF') THEN(GOTO CMDLBL(MSG))
SNDPGMMSG MSGID(&MSGID) MSGF(QCPFMSG) MSGDTA(&MSGDTA) MSGTYPE(*STATUS) TOPGMQ(*EXT)
END:
ENDPGM
And here is part of the display file DDS for displaying message:
A R MSG SFL
A SFLMSGRCD(24)
A S0MSGK SFLMSGKEY
A S0PGMQ SFLPGMQ
A R MSGCTL SFLCTL(MSG)
A OVERLAY
A SFLDSP
A SFLINZ
A SFLSIZ(0005)
A SFLPAG(0001)
A S0PGMQ SFLPGMQ
Suppose there is no matching record based on the query string, then RCVF causes CPF0864 to be sent out, and this message can be displayed on the screen without problem.
But if a record is found and the field values are used in the RTVDTAARA command, and the failure of this command (e.g. data area not found) will causes the problem I described above, which is that the received message can only be glimpsed in a short period of time and then disappears. Why this happens?
The typical sequence is
write msgctl
write bottom
exfmt main
Make sure that any record format displayed after the message subfile has OVERLAY specified. Without OVERLAY, 'bottom' will erase the message subfile and 'main' will erase 'bottom'.
Application Display Programming is an old but useful reference.
EDIT After seeing the CL and DDS.
I believe the issue is due to SNDPGMMSG MSGTYPE(*STATUS). Status messages are special, and do not normally go into a subfile message queue. The Messages section in the Infocenter has more information on the different message types.
In CL PGMB, change the SNDPGMMSG to MSGTYPE(*DIAG) TOPGMQ(*PRV). This will throw the exception message to the caller (to PGMA) as a diagnostic message. Double check that you have OVERLAY in the DDS where you need it - my example above that would be bottom and main.
This sequence worked and display the message of message-subfile on the screen
The typical sequence is
write msgctl
write bottom
exfmt main
Make sure that any record format displayed after the message subfile has OVERLAY specified. Without OVERLAY, 'bottom' will erase the message subfile and 'main' will erase 'bottom'.
c

How to display message at the bottom of a display file in CL program?

Suppose a display file has been declared in a CL program. It accepts some user input and conducts some validations to it. If it fails the validation a message would be displayed on the bottom of the display file. Is it possible to achieve this in CL? I have tried SNDPGMMSG with MSGTYPE(*DIAG), but the message is displayed only after the program has been terminated, and not on the display file during the execution.
The message to be sent is retrieved from message file so using field to display message is not applicable.
Normally we use message subfile to achive what you required above.
It can be done in display file for both CL and RPG
For CL example, you could read here http://www.mcpressonline.com/cl/the-cl-corner-letting-the-user-know-what-s-right-and-wrong.html.
You could search for "cl program message subfile" for other examples
Define a 75 character field in your display file DDS. Call it MESSAGE. In your CL do something like:
if (&option *ge '35') do
CHGVAR &MESSAGE 'Invalid option chosen'
goto getOption
enddo

Resources