Splunk Search

two's complement

clorne
Communicator

Hello I need to use the mathematical opération called "two's complement".
In C programming language it is written like that :
Complement=~B

I can't find a function similar in Splunk. If someone has an idea.

Regards

Tags (1)
0 Karma

Richfez
SplunkTrust
SplunkTrust

While it will take a minor amount of programming skills (probably not a lot), I think a scripted input may be your best choice. You could use either method described: stream it in via the script, or use the script to rewrite to a new file that Splunk reads. Either way, it's basically that you use the script to modify the latitude and longitude fields first into something like whate you need.

0 Karma

maciep
Champion

I don't think there is a function for that, but maybe you can use the answer below to save yourself some work. I guess you could just flip the bits during the replace as well?

http://answers.splunk.com/answers/222813/convert-an-hexadecimal-field-to-binary.html#answer-221785

0 Karma

clorne
Communicator

Thanks Maciep for your reply. I will be obliged to do this "string" manipulation since there is no binary operator
I do not vote for that because it seems very weird to me ...

0 Karma

richgalloway
SplunkTrust
SplunkTrust

What exactly are you trying to accomplish with two's complement? Perhaps there is another way to achieve your goal.

---
If this reply helps you, Karma would be appreciated.
0 Karma

clorne
Communicator

Hello richgalloway.
Thanks for your reply.
I have a log containing traffic data regarding planes. The purpose is to represent where the planes are.
In the log, the latitude and longitude are coded in "hex two's complement".
I need to translate the data in order to use the geostats function.

Since I did not find the function, I am preparing myself to translate each Hexadecimal character in binary code. And then replace each 1 by zero and each zero by one. But if I could find the function already done ...

Regards

0 Karma

richgalloway
SplunkTrust
SplunkTrust

I'm not aware of any function that will perform that calculation.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...