I have to admit that apart from the simplest expressions I don't understand regex.
I want to set up a logcheck ignore expression to ignore the following:
kernel: [220359.596744] [drm] nouveau 0000:06:00.0: Setting dpms mode 0 on tmds encoder (output 2)
The 220359.596744 number varies and so does the single mode digit, 0 in this instance, but the rest doesn't change.
I have tried by copying some expressions parrot fashion but can't get it to work.
Any help would be appreciated.
Try http://regexpal.com/ which gives instant feedback on your regex and sample data.
Tim.
On 11 May 2012 09:49, Barry Samuels bjsamuels@beenthere-donethat.org.uk wrote:
I have to admit that apart from the simplest expressions I don't understand regex.
I want to set up a logcheck ignore expression to ignore the following:
kernel: [220359.596744] [drm] nouveau 0000:06:00.0: Setting dpms mode 0 on tmds encoder (output 2)
The 220359.596744 number varies and so does the single mode digit, 0 in this instance, but the rest doesn't change.
I have tried by copying some expressions parrot fashion but can't get it to work.
Any help would be appreciated.
-- Barry Samuels http://www.beenthere-donethat.org.uk The Unofficial Guide to Great Britain
main@lists.alug.org.uk http://www.alug.org.uk/ http://lists.alug.org.uk/mailman/listinfo/main Unsubscribe? See message headers or the web site above!
Tim
That sounded like a very good idea but I can't do anything with it. What is it supposed to do? There seems to be no practical help i.e. how to work it.
I've put my regular expression in the top box and the expression I'm trying to match in the lower box whereupon the some of the characters in the top box are highlighted with different colours.
What is supposed to happen then?
On 11/05/12 09:49, Barry Samuels wrote:
I want to set up a logcheck ignore expression to ignore the following:
kernel: [220359.596744] [drm] nouveau 0000:06:00.0: Setting dpms mode 0 on tmds encoder (output 2)
The 220359.596744 number varies and so does the single mode digit, 0 in this instance, but the rest doesn't change.
I found the following documentation helpful: http://www.agentbob.info/agentbob/g3/83-AB.html
.. albeit useless without knowing regexs. But without a logcheck install to test with, I'd guess at a rule along the lines of:
^kernel: [[0-9.]{13}] [drm] [[:almun:]]+ [0-9:.]{12}: Setting dpms mode
Reading left to right: ^kernel: = start of line (^) followed by the text "kernel: " [ = open square bracket, escaped because [ means something in a regex [0-9.]{13} = anything in the square brackets (in this case digits 0 to 9 or ".", again escaped because "." has special meaning), 13 of them (to match 220359.596744) ] [drm] = matches "] [drm] " [[:alnum:]]+ = matches one or more ("+") alphanumerics (to pick up "nouveau" - I could have just put "nouveau" directly but doing it this way would match a different driver too, provided it just used alphanumerics anyway!) [9-9:.]{12} = 12 of the characters in the square brackets to match 0000:06:00.0 : Setting dpms mode = direct text match
As I didn't restrict the match to the full line (by ending the regex with $ to match end of line), the expression doesn't care what happens after that.
Of-course the trick with these things is only to exclude the ones you want to lose without catching others that you want. So if you wanted to literally only match the lines you describe it would be simpler: ^kernel: [[0-9.]{13}] [drm] noveau 0000:06:00.0: Setting dpms mode [0-9]+ on tmds encoder (output 2)$
With a bit of luck those should get you started, and like I said at the start they're untested.
Mark
On 11/05/2012 09:49, Barry Samuels wrote:
I have to admit that apart from the simplest expressions I don't understand regex.
I'm crap on that as well...
I want to set up a logcheck ignore expression to ignore the following:
kernel: [220359.596744] [drm] nouveau 0000:06:00.0: Setting dpms mode 0 on tmds encoder (output 2)
The 220359.596744 number varies and so does the single mode digit, 0 in this instance, but the rest doesn't change.
I have tried by copying some expressions parrot fashion but can't get it to work.
Any help would be appreciated.
Here is how I would deal with that:
kernel: [.* Setting dpms mode
Cheers, Laurie.
On 11/05/12 14:39:33, Laurie Brown wrote:
On 11/05/2012 09:49, Barry Samuels wrote:
I have to admit that apart from the simplest expressions I don't understand regex.
I'm crap on that as well...
I want to set up a logcheck ignore expression to ignore the following:
kernel: [220359.596744] [drm] nouveau 0000:06:00.0: Setting dpms mode
0 on
tmds encoder (output 2)
The 220359.596744 number varies and so does the single mode digit, 0
in
this instance, but the rest doesn't change.
I have tried by copying some expressions parrot fashion but can't get
it
to work.
Any help would be appreciated.
Here is how I would deal with that:
kernel: [.* Setting dpms mode
Cheers, Laurie.
Laurie Brown laurie@brownowl.com
Thanks to Mark for having a try at the expression but it didn't work. Laurie's simple version appears to have done the trick.
Thanks to you both.
On 11/05/12 17:13, Barry Samuels wrote:
Thanks to Mark for having a try at the expression but it didn't work. Laurie's simple version appears to have done the trick. Thanks to you both.
No problem.
Just be careful with less specific versions that you don't miss things that matter (I'm sure you're fine here but just make sure you consider it).
I've seen situations where a problem occurs and you spend ages trying to diagnose it only to discover that the critical messages were being stripped from the logs. As long as you don't care about *any* message that starts "kernel" and has "Setting dpms mode" in it you'll be fine here, including any other driver that might decide to set dpms mode in the future!
On 11/05/12 17:27:19, Mark Rogers wrote:
On 11/05/12 17:13, Barry Samuels wrote:
Thanks to Mark for having a try at the expression but it didn't work. Laurie's simple version appears to have done the trick. Thanks to you both.
No problem.
Just be careful with less specific versions that you don't miss things that matter (I'm sure you're fine here but just make sure you consider it).
I've seen situations where a problem occurs and you spend ages trying to diagnose it only to discover that the critical messages were being stripped from the logs. As long as you don't care about *any* message that starts "kernel" and has "Setting dpms mode" in it you'll be fine here, including any other driver that might decide to set dpms mode in the future!
-- Mark Rogers // More Solutions Ltd (Peterborough Office) // 0844 251 1450 Registered in England (0456 0902) 21 Drakes Mews, Milton Keynes, MK8 0ER
Nothing is actually being removed from the logs it just prevents a constant flow of emails to me about it.
I may experiment in slowly adding to that simplified expression to see if I can get a more focussed match.
That documentation link you provided could be very useful. Thanks.
On 11/05/12 18:11, Barry Samuels wrote:
Nothing is actually being removed from the logs it just prevents a constant flow of emails to me about it.
Good point, I'd forgotten where we started!