I am trying to send Text and Map JMS Messages to JMeter using the option to upload the message as a file. While the Text Message is getting sent fine, my Map Message is not getting sent. This is the error I am getting
1476200492861,0,JMS Publisher,000,java.lang.IllegalArgumentException:
line must have 3 parts: ,Point to piont 1-1,,false,,0,1,1,0,0
Here is a sample Map Message
$Header:
JMSMessageID=ID:LRTPSDMMK3.E08570CF87913A8D:1051
JMSTimestamp=Thu May 26 14:35:18 231 BST 2016
JMSDestination=Queue[MyQueue]
JMSDeliveryMode=PERSISTENT
JMSPriority=4
$Properties:
Server=String:WSO2 Carbon Server
Content-Length=String:340
Date=String:Thu, 26 May 2016 13:35:17 GMT
Content-Type=String:text/xml;charset=UTF-8
$MapBody:
TY=String:9
I think the formatting of my sample file must be wrong, but I can't find an example of how a Map Message should look like in a file. Can anyone help?
The problem was the formating of my message. According to the JMeter source code, JMeter requires 3 params to be separated by 2 commas. Formatting my sample to fit that criteria worked a charm.
for (String line : lines){
String[] parts = line.split(",",3);
if (parts.length != 3) {
throw new IllegalArgumentException("line must have 3 parts: "+line);
}
Related
Accurately, I want to filter logs and send some warning email.
Firstly, I tried ommail, but unfortunately, this module only support mail server which do not need authentication, but my mail server needs.
So I tried to use omprog, I wrote a python script to logon to my mail server, it will recieve one parameter which is the log and send it as mail body.
Then I got the problem, I cannot pass the log to my script, if I try like this, $msg will be recognized as a string .
if $fromhost-ip == "x.x.x.x" then {
action(type="omprog"
binary="/usr/bin/python3 /home/elancao/Python/sendmail.py $msg")
}
I tried to search the official doc.
module(load="omprog")
action(type="omprog"
binary="/path/to/log.sh p1 p2 --param3=\"value 3\""
template="RSYSLOG_TraditionalFileFormat")
but in the sample, what they are using is a string "p1", not a dynamic parameter.
Can you please help? Thanks a lot!
The expected use of omprog is for your program to read stdin and there it will find the full default RSYSLOG_FileFormat template data (with date, host, tag, msg). This is useful, as it means you can write your program so that it is started only once, and then it can loop and handle all messages as they arrive.
This cuts down on the overhead of restarting your program for each message, and makes it react faster. However, if you prefer, your program can exit after reading one line, and then rsyslog will restart it for the next message. (You may want to implement confirmMessages=on).
If you just want the msg part as data, you can use template=... in the action to specify your own minimal template.
If you really must have the msg as an argument, you can use the legacy filter syntax:
^program;template
This will run program once for each message, passing it as argument the output of the template. This is not recommended.
if omprog script is not doing or not saving to a file the problem is that :
rsyslog is sending the full message to that script so you need to define or use a template
your script needs to listen to and return an
example in perl whit omprog
#my $input = join( '-', #ARGV ); ///not working I lost 5 hours of my life
my $input = ; now this is what you need
Hope this what the perl/python/rsyslog community needs.
We are using Golang and .NET Core for our inter-communication microservices infrastructure.
All the data across the services are coming based on Protobuffs Protocols that we have created.
Here is an example of one of our Protobuffs:
syntax = "proto3";
package Protos;
option csharp_namespace = "Protos";
option go_package="Protos";
message EventMessage {
string actionType = 1;
string payload = 2;
bool auditIsActive = 3;
}
Golang is working well and the service is generating the content as needed and sending it to the SQS queue, once that happens the .NET core service is getting the data and trying to serialize it.
Here are the contents of the SQS message example:
{"#type":"type.googleapis.com/Protos.EventMessage","actionType":"PushPayload","payload":"<<INTERNAL>>"}
But we are getting an Exception that saying the wire-type is not defined as mentioned below:
Google.Protobuf.InvalidProtocolBufferException: Protocol message contained a tag with an invalid wire type.
at Google.Protobuf.UnknownFieldSet.MergeFieldFrom(CodedInputStream input)
at Google.Protobuf.UnknownFieldSet.MergeFieldFrom(CodedInputStream input)
at Google.Protobuf.UnknownFieldSet.MergeFieldFrom(UnknownFieldSet unknownFields, CodedInputStream input)
at Protos.EventMessage.MergeFrom(CodedInputStream input) in /Users/maordavidzon/projects/github_connector/GithubConnector/GithubConnector/obj/Debug/netcoreapp3.0/EventMessage.cs:line 232
at Google.Protobuf.MessageExtensions.MergeFrom(IMessage message, Byte[] data, Boolean discardUnknownFields, ExtensionRegistry registry)
at Google.Protobuf.MessageParser`1.ParseFrom(Byte[] data)
The Proto file is exactly the same in both of the services.
Is there any potential missing options or property that we need to add?
It looks like you're using the JSON format rather than the binary format. In that case, you want ParseJson(string json), not ParseFrom(byte[] data).
Note: the binary format is more efficient, if that matters to you. It also has better support across protobuf libraries / tools.
Basically there are two possible scenarios, or your protos files generated for .NET and GoLang are not in the same version or your data has been corrupted while transferring between GoLang and .NET application.
Protobuf is a binary protocol, check if you have any http filter or anything else that can change incoming or outgoing stream of bytes.
I have an Go app (web service) which returns errors in json like this:
{errorString: "internal server error"}
It's not ok because "internal server error" is just some programmer error string not usefull for client. The solution is to add error codes:
{errCode: 1, errorString: "internal server error"}
Now, client known that 1 means "internal server error" and can process it as want. For example, show for user message "Internal Server Error" or (in my case) the same in russian lang.
Ok.
So, obviously i need some file where all error constants will be described.
For ex. errors.go
const (
ErrNo = iota
// Common Errors
ErrNotFound
ErrInternalServerError
**// More specified errors**
)
The problem is in More specified errors section.
I have 2 ways:
places all errors definiton in one file errors.go
try to place specific errors to each related file:
my controller is devided on several files in package server:
clienthandler.go -- for client requests,
orderhandler.go -- for orders requests and so on.
specific client errors must be places in clienthandler.go, order errors in orderhandler.go
But how it can be realized?
I know one simple solution:
Take some max count of errors for each controller, for example 1000.
clienthandler.go
package server
const (
ErrCheckIdCity = 1000*1 + iota
ErrCheckName
)
that is 1000 errors (from 1000 to 1999) reserved for this file
orderhandler.go
package server
const (
ErrCheckIdCity = 1000*2 + iota
ErrCheckItem
)
that is 1000 errors (from 2000 to 2999) reserved for this file
But disadvantge is that we limit myself by 1000 errors per controller
May be thers is some better way?
Or i need just use one global errros.go file ) ?
Place each error where it's originated and export it.
See the link from my comment.
var ErrInvalidParam = fmt.Errorf(“invalid parameter [%s]”, param)
If you want to add an error code, create a new type satisfying the error interface and add the appropriate members like errorCode or related data.
If you want, create a build method as helper, similar as errors.New does
I want to use jp#gc - Graphs Generator in my Test Plan to create graphs from existing results file(results.csv).
I am getting error - "Error loading file".
My results.csv file has data like below:
14:31:14;1208;login;200;OK;Thread Group 1-2;text;true;950;10;10;1208;1;0;U6021712-TPL-A
I am not sure how Graphs Generator will be able to create various graphs using the data mentioned above. On checking the error log I noticed below message:
2014/12/12 14:31:29 INFO - jmeter.save.CSVSaveService: results.csv does not appear to have a valid header. Using default configuration.
2014/12/12 14:31:29 WARN - jmeter.save.CSVSaveService: Error parsing field 'timeStamp' at line 1 java.text.ParseException: Unparseable date: ""
2014/12/12 14:31:29 WARN - jmeter.reporters.ResultCollector: Problem reading JTL file: results.csv
Any help would be much appreciated!
As error message says, you have an error in the definition of timestamp field on the JMeter instance where you run this code.
And configuration differs from the one that led to the CSV file you got.
So you need to check that you use the same jmeter.properties and user.properties on this instance that the one you used on the instance that generated the CSV.
For example here you should have this to fix this issue (but you may have other issues):
jmeter.save.saveservice.timestamp_format=HH:mm:ss
In Jmeter, timeStamp is long datatype. So make sure that no spaces in timeStamp row (If you have a space , jmeter doesn't accept it and throws
java.lang.NumberFormatException: For input string: "timeStamp"
Example:
Valid data set
1456177238234,224,Java Request 1,200,,Auto Quick Invest 1-1,,true,,0,2,2,null,0,1,0,M-SFO1-SFO1216
Invalid data set
1456177238234,224,Java Request 1,200,,Auto Quick Invest 1-1,,true,,0,2,2,null,0,1,0,M-SFO1-SFO1216
Because timeStamp field has space.
Using WMQ7.0 with WMB 6.1
I have one flow where I am transforming a message and using MQRFH2.usr for holding some data.
But, I am facing the issue where the MQRFH2.usr is coming in the main message body.
I have deployed the same code in different environments, but I am getting this issue only in one environment.
So, it doesn't seems to be a code issue. It has something to do with configurations.
Kindly, suggest what could be the possible cause.
Check the queue's PROPCTL setting. If this is set to NONE then the behavior is as follows:
If the application does not create a message handle, all the message
properties are removed from the MQRFH2. Name/value pairs in the MQRFH2
headers are left in the message.
Be sure to read the doc page through a couple of times and maybe test with different settings to understand fully how PROPCTL modifies the message content your app receives.
The MQRFH2 headers, if present, always come in the payload part of the message (that's the way webpshere organizes it). You can receive one or more MQRFH2 headers (structures).
Perhaps you are expecting only one and are receiving two? This would explain your message data being left with gibberish.
I use the following code to handler these heards upon receiving a message
MQRFH2 header = null;
// Find and store message length
int msglen = replyMessage.getMessageLength();
MQHeaderList list = new MQHeaderList(replyMessage);
int indexOf = list.indexOf("MQRFH2");
if (indexOf >= 0) {
header = (MQRFH2) list.get(indexOf);
msglen = msglen - header.size();
}
String msgText = replyMessage.readStringOfCharLength(msglen);
Hope it helps.
Martins