Painless script for converting Long to Hexadecimal

Have Kibana display a numeric field value in hexadecimal is locked, and the example is an image (and broken) which is not useful for cut-and-paste. If it wasn't locked I'd just reply there.

I needed to change the of packetbeats to hex so that I could easily visualize my wireshark pcap files.

Here is the painless script I used for that.

if (doc[''].size()==0) {
  return "";

long dnsId = doc[''].value;

String asHex = Long.toHexString(dnsId);

return "0x" + asHex
1 Like

Hey @baerrach I've just open that topic, could please copy and paste your solution on that topic and close this one?

@markov00 Done. But I can't see how to close this one.

@baerrach thanks for that :heart:
I will close this for you