cancel
Showing results for 
Search instead for 
Did you mean: 

how to add header with help of rules which creates messageID for each Request in Virtual server

SOLVED
Highlighted
New Contributor

how to add header with help of rules which creates messageID for each Request in Virtual server

Hi Team,

we are trying to add rules which add header contains random messageID via rules for all incoming request.

so please guide us how to create it.

is it possible to create above condition via rule builder or traffic scripts?

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Manager

Re: how to add header with help of rules which creates messageID for each Request in Virtual server

Are you looking to create a MessageID for use with SMTP, or for some other use? Or just to track unique transactions downstream? In general, you could create a random code to insert into a header, or a cookie, or into the response sent back to the client.

 

For example, this fragment uses a simple random sequence of eight bytes, hex-encoded:

 

# Random, suitable for cryptographic use
$myMessageID = string.hexencode(string.randomBytes( 8 ));
http.setHeader( "X-My-Header", $myMessageID );

 

 

Alternatively, this constructs an ID including micro-second timing and hostname:

 

# Random, machine id, date/time, hostname
$myMessageID =
string.sprintf( "%.6f", sys.time.highres()) . "@" . sys.hostname() . "." . sys.domainname());
http.setHeader( "X-My-Header", $myMessageID );

 

Are you looking to simply log the MessageID in your SIEM, or to use it for additional processing?

For example, if you are looking to track the time taken individual transactions, you could use our analytics application with Services Director, or you could use connection tracing, as shown here:

https://community.pulsesecure.net/t5/Pulse-Secure-vADC/Finding-a-needle-in-your-haystack-using-the-c...

 

View solution in original post

2 REPLIES 2
Highlighted
Community Manager

Re: how to add header with help of rules which creates messageID for each Request in Virtual server

Are you looking to create a MessageID for use with SMTP, or for some other use? Or just to track unique transactions downstream? In general, you could create a random code to insert into a header, or a cookie, or into the response sent back to the client.

 

For example, this fragment uses a simple random sequence of eight bytes, hex-encoded:

 

# Random, suitable for cryptographic use
$myMessageID = string.hexencode(string.randomBytes( 8 ));
http.setHeader( "X-My-Header", $myMessageID );

 

 

Alternatively, this constructs an ID including micro-second timing and hostname:

 

# Random, machine id, date/time, hostname
$myMessageID =
string.sprintf( "%.6f", sys.time.highres()) . "@" . sys.hostname() . "." . sys.domainname());
http.setHeader( "X-My-Header", $myMessageID );

 

Are you looking to simply log the MessageID in your SIEM, or to use it for additional processing?

For example, if you are looking to track the time taken individual transactions, you could use our analytics application with Services Director, or you could use connection tracing, as shown here:

https://community.pulsesecure.net/t5/Pulse-Secure-vADC/Finding-a-needle-in-your-haystack-using-the-c...

 

View solution in original post

Highlighted
New Contributor

Re: how to add header with help of rules which creates messageID for each Request in Virtual server

Thanks Team for the reply.

i will test the rule and reply back.

 

All i want one randon code to track the message transaction.

i think this code will work.