Hi! Could you point me where the logs format is explained? Or could you explain the logs formats and its variations?
I'm trying to create some grok patterns to parse those logs with logstash
Thanks
Comment From: alexcoco
Hi @Garito! I'm no authority on Redis but I was curious about your question so I took a look. The log format can be found here. The format for the non raw output appears to be: - PID - A character describing the role of the process, described in this commit message - Date & time - A character describing the log level - The message to log
Here's an example:
534:M 28 Apr 11:30:29.988 * DB loaded from disk: 0.002 seconds
where 534 is the PID, M is the role, 28 Apr 11:30:29.988 is the date & time, * is the log level, and the rest is the message.
Comment From: antirez
Hello, log format is not currently part of the "API", that is, it may change in random ways even if we try to avoid this. Soon or later we'll try to make it a more formal format, maybe just documenting the current log format. However I would like to improve the message formats for example prefixing with the subsystem, like in:
[replication sync-ok] Sync with master successful.
And so forth. So that we have an human message (that can change freely) and an easy to parse message.
Comment From: Garito
Hi! Thanks! @alexcoco this is the pattern I've deduced by myself so far: REDIS3LOG %{POSINT:pid}:%{NOTSPACE:role} %{REDISTIMESTAMP:timestamp} %{GREEDYDATA:the_message}
I can imporve it with your help like: REDIS3LOG %{POSINT:pid}:%{NOTSPACE:role} %{REDISTIMESTAMP:timestamp} %{NOTSPACE:loglevel} %{GREEDYDATA:the_message}
Thanks a lot for your help, I will use this by now
@antirez It is ok for me if you need to change this format if it is clearly documented (no doc right now) and take into account whenever you change it
Logs are super important for a bunch of people (more since the log treatment is so easy and automatic) Will be nice to be an important part of you awesome code
Can I do something for you in that sense?
Thanks a lot!
Comment From: dalzzing2
@antirez Can you tell if it's in API format now? Thank you
Comment From: dalzzing2
@alexcoco You said you weren't an administrator... When you check the URL you have written, it is in the code format below.
fprintf(fp,"%d:%c %s %c %s\n",
(int)getpid(),role_char, buf,c[level],msg);
The actual log file is recorded as follows. ( v 2.6.8 )
[18262] 12 Jan 10:00:10.214 * Background saving started by pid 5032
Do you know, where is [ ] in Source code and role_char?
Comment From: dalzzing2
@antirez @alexcoco As a result of testing, I confirmed that my version was low.
In majors 3, 4, 5 and 6, all log formats were the same as what you said.