Trying to understand the REDIS Monitor command

I am trying to understand the MONITOR command , which is available in Redis, and how I can use it effectively to determine the load of my application. What I don't understand is how to read the information displayed in the CLI. Like, I know that the number before the IP address is a "DB index", but what can I deduce from this number?

An example that is available on MONITOR :

$ redis-cli monitor
1339518083.107412 [0 127.0.0.1:60866] "keys" "*"
1339518087.877697 [0 127.0.0.1:60866] "dbsize"
1339518090.420270 [0 127.0.0.1:60866] "set" "x" "6"
1339518096.506257 [0 127.0.0.1:60866] "get" "x"
1339518099.363765 [0 127.0.0.1:60866] "del" "x"
1339518100.544926 [0 127.0.0.1:60866] "get" "x"

I can not understand the meaning of "1339518083.107412".

+5
source share
2 answers

The first part is a timestamp in the form of seconds.microseconds.

+8
source

- 1970/1/1 ( Unix). , , :

new DateTime(1970,1,1).AddSeconds(seconds).AddMilliseconds(microsecods/1000).ToLocalTime()

, :

var match = Regex.Match(line, @"(?<seconds>\d+)\.(?<microsec>\d+) (?<client>\[[\d\.\s:]+?\]) \""(?<command>\w+?)\""");
var sec = long.Parse(match.Groups["seconds"].Value);
var mic = long.Parse(match.Groups["microsec"].Value);
var rest = line.Substring(match.Groups["command"].Index + match.Groups["command"].Length + 1).Trim();
var command = match.Groups["command"].Value,
var dateTime = new DateTime(1970, 1, 1).AddSeconds(sec).AddMilliseconds(mic / 1000).ToLocalTime()
0

All Articles