I have this log from one of my server: Aug 23 12:30:01 vm-graylog root: /dev/mapper/cl-root 396G 220G 176G 56% /
I would like to extract the freespace information (176), i have already made a regular expression :
.?\d+.?\d+.?\d+.?\d+.?\d+.?\d+.*?(\d\d+) who “works” but it’s not a good solution because when i have same log like : Aug 23 12:30:01 eyesofnetwork root: /dev/mapper/eyesofnetwork-root 14G 3,8G 9,7G 28% / and i want to extract 9.7 or just 9 my regex doesn’t fonctionning…
I am searching for a long time a solution (by me or by other) but i didn’t find any good solution.
Do you have any tips, advices or solutions for me ?
Thank you so much jochen for the advice, it works very well and for both df -h logs!
%{SYSLOGBASE}%{SPACE}%{PATH}%{SPACE}%{WORD}%{SPACE}%{PROG}%{SPACE}%{NUMBER:FreeSpace;int}
Meanwhile, my grok pattern doesn’t take number like numerical field even if i put “;int” at the end, is it a bug ?
To solve this i have made an other extractor, a copy input, and i converter my data in numerical, in order to make widget with good informations.