Quarkus syslog message format - elastic-stack

I am usung quarkus to log some events from application to elasticsearch as syslog, look at
quarkus.log.syslog.enable=true
quarkus.log.syslog.endpoint=elkhost:7001
quarkus.log.syslog.protocol=udp
quarkus.log.syslog.use-counting-framing=false
quarkus.log.syslog.app-name=MYAPP
quarkus.log.syslog.hostname=MYHOST
quarkus.log.syslog.level=ALL
quarkus.log.syslog.format=%m%n
Notice %m is only thing to log, no another data. RFC format is default. And from Kabana i see
<14>1 2020-02-29T11:43:06.001+03:00 MYHOST MYAPP 9348 test - test messagee
How must I set quarkus logging to write ONLY message sent? Only "test massage" without any text left of message.

Reading the Syslog RFC 5424, this format is not customizable in the way you expect.
Syslog message is composed from mandatory parts :
PRI
HEAD
MSG
So you can not reduce a syslog message to its MSG part only.
Quarkus is not the restriction here but RFC 5424.

Related

MQ decoding cuts off dots (...) and changes the message length

We are using IBM MQ Series 9 and we are facing a decoding problem.
The messages are being sent from a mainframe with an encoding of 424 (Hebrew) to a Windows-based system. The system pulls the messages out of the queue and parses the messages, and after that, cuts the messages in different parts for advanced parsing.
All messages might include Hebrew characters, hence I am obligated to use Hebrew encoding.
A message in the MQ can look like this:
9921388ABC.........3323DDFF.....43332FFF...2321......
After reading the message and parsing it using different code pages the message either doesn't reach the system (using 424, 916) or reaches the system but looks like this:
9921388ABC3323DDFF43332FFF2321
The messages are shorter and are unparseable.
I ahve tried to consult with our MQ people but they are clueless about this problem.
Would very appreciate any kind of help.
Thank you.

Flume TAILDIR Source to Kafka Sink- Static Interceptor Issue

The scenario I'm trying to do is as follows:
1- Flume TAILDIR Source reading from a log file and appending a static interceptor to the beginning of the message. The interceptor consists of the host name and the host IP cause it's required with every log message I receive.
2- Flume Kafka Producer Sink that take those messages from the file and put them in a Kafka topic.
The Flume configuration is as follows:
tier1.sources=source1
tier1.channels=channel1
tier1.sinks =sink1
tier1.sources.source1.interceptors=i1
tier1.sources.source1.interceptors.i1.type=static
tier1.sources.source1.interceptors.i1.key=HostData
tier1.sources.source1.interceptors.i1.value=###HostName###000.00.0.000###
tier1.sources.source1.type=TAILDIR
tier1.sources.source1.positionFile=/usr/software/flumData/flumeStressAndKafkaFailureTestPos.json
tier1.sources.source1.filegroups=f1
tier1.sources.source1.filegroups.f1=/usr/software/flumData/flumeStressAndKafkaFailureTest.txt
tier1.sources.source1.channels=channel1
tier1.channels.channel1.type=file
tier1.channels.channel1.checkpointDir = /usr/software/flumData/checkpoint
tier1.channels.channel1.dataDirs = /usr/software/flumData/data
tier1.sinks.sink1.channel=channel1
tier1.sinks.sink1.type=org.apache.flume.sink.kafka.KafkaSink
tier1.sinks.sink1.kafka.bootstrap.servers=<Removed For Confidentiality >
tier1.sinks.sink1.kafka.topic=FlumeTokafkaTest
tier1.sinks.sink1.kafka.flumeBatchSize=20
tier1.sinks.sink1.kafka.producer.acks=0
tier1.sinks.sink1.useFlumeEventFormat=true
tier1.sinks.sink1.kafka.producer.linger.ms=1
tier1.sinks.sink1.kafka.producer.client.id=HOSTNAME
tier1.sinks.sink1.kafka.producer.compression.type = snappy
So now I'm testing, I ran a Console Kafka Consumer and I started to write in the source file and I do receive the message with the header appended.
Example:
I write 'test' in the source file and press Enter then save the file
Flume detect the file change, then it sends the new line to Kafka producer.
My consumer get the following line:
###HostName###000.00.0.000###test
The issue now is that sometimes, the interceptor doesn't work as expected. It's like Flume sends 2 messages, one contains the interceptor and the other one the message content.
Example:
I write 'hi you' in the source file and press Enter then save the file
Flume detect the file change, then it sends the new line to Kafka producer.
My consumer get the following 2 line:
###HostName###000.00.0.000###
hi you
And the terminal scrolls to the the new message content.
This case always happen when I type 'hi you' in the text file, and since I read from a log file, then it's not predictable when it happens.
Help and support will be much appreciated ^^
Thank you
So the problem was from Kafka Consumer. It receives the full message from flume
Interceptor + some garbage characters + message
and if one of the garbage characters was \n (LF in Linux systems) then it assumes its 2 messages, not 1.
I'm using Kafka Consumer element in Streamsets, so it's simple to change the message delimiter. I made it \r\n and now it's working fine.
If you are dealing with the full message as a string and want to apply a regex on it or want to write it to a file, then it's better to replace \r and \n with an empty string.
The full walkthrough to the answer can be found here:
https://community.cloudera.com/t5/Data-Ingestion-Integration/Flume-TAILDIR-Source-to-Kafka-Sink-Static-Interceptor-Issue/m-p/86388#M3508

Implementation of IDNs in JIDs as specified in RFC 6122

I have added International Domain Name support to an XMPP client as specified in RFC 6122. In the RFC it states:
Although XMPP applications do not communicate the output of the
ToASCII operation (called an "ACE label") over the wire, it MUST be
possible to apply that operation without failing to each
internationalized label.
However, with the domain I have available for testing (running Prosody 0.9.4; working on getting feedback from someone else about how Ejabberd handles this), sending a Unicode name in the "to" field of an XMPP stanza causes them to immediately return an XMPP error stanza and terminate the stream. If I apply the toASCII operation before sending the stanza, the connection succeedes, and I can begin authentication with the server.
So sending:
<somestanza to="éxample.net"/>
Would cause an error, while:
<somestanza to="xn--xample-9ua.net"/>
works fine.
Is it correct to send the ASCII representation (ACE label) of the domain like this? If so, what does the spec mean when it says that "XMPP applications do not communicate the output of the ToASCII operation ... over the wire"? If not, how can I ensure compatibility with misbehaving servers?

JMeter TCP Sampler doesn't recognize end of stream

I'm trying to run a simple test with TCP Sampler
When using default TCPClient class, after the response timeout time passes, I receive a correct response from the server, and then Error 500 in sampler results:
Response code: 500 Response message:
org.apache.jmeter.protocol.tcp.sampler.ReadException:
It seems like that JMeter does not recognize end of message characters (the server sends \r\n).
How can I configure JMeter to see the EOM?
I tried to use BinaryTCPClientImpl, and set tcp.BinaryTCPClient.eomByte = 13 in Jmeter.properties, but binaryTCPClient expects HEX data, while I send human readable string, and it still ignores the eomByte...
Any ideas?
Found the problem.
Those server did not sent \r\n in several cases.
Everything started working after the server was fixed.
I came accross the same behaviour and examined the offered responses (sending \r\n at the end of the message in the server side \ setting the eol byte value option in the gui) but it didn't work for me.
My solution: Following this question I found that \0 is the eol character Jmeter expects in TCP sampler. when my server terminates the messages with \0 - the message is receieved in Jmeter.
Some more references: Jmeter documentation (TCPClientImpl chapter - that's where the tcp.eolByte is discussed).
Some option: if the size of the messages is constant, one can examine LengthPrefixedBinaryTCPClientImpl (see this discussion).
Anyone give me a solution for this error. Why I m getting 500 response code why jmeter throwing the read exception and what is the solution for this error if I already received my success response.
TCP Sampler will not return until EOF is received.
Set your own EOF byte value at TCP Sampler.
The server sends a stream at the end of EOF byte value.

how does XMPP client select an authentication mechanism?

I'm trying to learn the XMPP spec (RFC 3920) by coding it in low-level Python. But I've been hung up for over an hour at step 4 of section 6.5, selecting an authentication mechanism. I'm sending: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'/>, and getting: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><incorrect-encoding/></failure> instead of a base64-encoded challenge.
The "incorrect-encoding" error is supposedly to be used for when I incorrectly base64-encode something, but there was no text to encode. I'm probably missing something really obvious. Anybody got a cluestick?
I'm using talk.google.com port 5222 as the server, if that matters. I doubt that it does; this is almost definitely due to my lack of understanding this section of the RFC. And the problem isn't likely my code, other than the way I'm sending this particular stanza, or it would be failing at the previous steps. But for what it's worth, here is the code I've got so far, and the complete log (transcript of the session). Thanks.
First off, RFC 6120 is often more clear than 3920. [updated to point to the RFC as released]
Since you're using SASL PLAIN (see RFC 4616), many servers expect you to send a SASL "initial response" in the auth element, consisting of:
base64(\x00 + utf8(saslprep(username)) + \x00 + utf8(saslprep(password)))
All together, then, your auth element needs to look like this:
<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
mechanism='PLAIN'>AGp1bGlldAByMG0zMG15cjBtMzA=</auth>
For the username "juliet" and the password "r0m30myr0m30".