Results 1 to 8 of 8

Thread: Need helps with pop-up using emerg and grep

  1. #1

    Default Need helps with pop-up using emerg and grep

    I have to generate an alert pop-up notification which appears on the bottom-right of the screen when sudo command is typed and also logged in /var/log/warn. I assume to configure rsyslog.conf to something like

    if ($msg == 'sudo') \
    then *emerg logger -p user.emerg .....

    I cannot get that to work through.

    Also having trouble using grep to filter files that sent by specific host and within a time-range in /var/log/messages. For instance, filter files that sent by kernel in the afternoon today or yesterday. I only got upto: sudo grep --color 'kernel'. I cannot figure out how to use AND operation in grep as when I tried sudo grep --color 'kernel \|^Oct' /var/log/messages, it will just highlight either having Oct at the beginning or kernel.


    Regards,

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,171

    Default Re: Need helps with pop-up using emerg and grep

    It is an advantage most of the time when you tell your potential helpers which version of openSUSE you use. Also, I see you mention "bottom right of th screen". I assume that is in a
    user's loged in desktop. Must that be all kinds of desktops? Or do you have a specific one in mind.

    Also I am not quite sure that the description what should happen when is precise enough (but that may be just me). Do I understand that in the case that one of the users loged in in the system using the real console (CLI) or a terminal emulator (from the GUI) starts the /usr/bin/sudo program (only the typing of the string "sudo" as you say it above, does not trigger very much IMHO), a pop-up must appear on the screen of all (or maybe only one, but which one) users loged in in the GUI on the system?
    Henk van Velden

  3. #3
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    11,306
    Blog Entries
    2

    Default Re: Need helps with pop-up using emerg and grep

    Depending on what you're doing, you might be able to accomplish the "and" logic by piping grep twice... In the following example the results would be only entries with string1 "and" string2
    eg
    Code:
    tail -n 100 /var/log/messages | grep string1 | grep string2 
    TSU

  4. #4

    Default Re: Need helps with pop-up using emerg and grep

    Quote Originally Posted by wvgfHdlyf View Post
    I have to generate an alert pop-up notification which appears on the bottom-right of the screen when sudo command is typed and also logged in /var/log/warn. I assume to configure rsyslog.conf to something like


    Also having trouble using grep to filter files that sent by specific host and within a time-range in /var/log/messages. For instance, filter files that sent by kernel in the afternoon today or yesterday. I only got upto: sudo grep --color 'kernel'. I cannot figure out how to use AND operation in grep as when I tried sudo grep --color 'kernel \|^Oct' /var/log/messages, it will just highlight either having Oct at the beginning or kernel.


    Regards,
    Starting ^ with Oct with any amount of characters .* in between with the kernel on the same line
    Code:
    grep '^Oct.*kernel' /var/log/messages
    "Unfortunately time is always against us" -- [Morpheus]

    .:https://github.com/Jetchisel:.

  5. #5

    Default Re: Need helps with pop-up using emerg and grep

    Quote Originally Posted by wvgfHdlyf View Post
    I have to generate an alert pop-up notification which appears on the bottom-right of the screen when sudo command is typed and also logged in /var/log/warn.

    Regards,
    Without more info like Henk said it will be hard to tell. Like if the sudo command is typed? I assume in the shell but which shell? Also i assume you are using some key logger apps/tool of some sort.
    "Unfortunately time is always against us" -- [Morpheus]

    .:https://github.com/Jetchisel:.

  6. #6

    Default Re: Need helps with pop-up using emerg and grep

    Thanks for all replies. It is LinuxZ14.

  7. #7
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,171

    Default Re: Need helps with pop-up using emerg and grep

    Quote Originally Posted by wvgfHdlyf View Post
    Thanks for all replies. It is LinuxZ14.
    ????

    What do you mean with that? We asked for the version of openSUSE you use. The above does not answer that. When you do not know, post the output of
    Code:
    cat /etc/os-release
    And please do so between CODE tags, which you get by clicking on the # button in the tool bar of the post editor.

    Also people asked for a more precise definition of what you want to achieve. The above does not contain anything to clarify your goal.

    It is nice when you say "Thanks for all replies.", but when you do not take the trouble to answer questions, the trouble others take to try to help you will be in vain and people will stop talking to you.
    Henk van Velden

  8. #8
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Need helps with pop-up using emerg and grep

    On 2014-10-18 17:36, hcvv wrote:

    > Also people asked for a more precise definition of what you want to
    > achieve. The above does not contain anything to clarify your goal.
    >
    > It is nice when you say "Thanks for all replies.", but when you do not
    > take the trouble to answer questions, the trouble others take to try to
    > help you will be in vain and people will stop talking to you.


    Also, there are two very different questions here. One is about rsyslog,
    another about grep. I hesitate which one to reply .

    On 13.1, sudo already logs. If you manage to create the emergency
    message, you will be pestered by cronjobs triggering it.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 13.1 x86_64 "Bottle" at Telcontar)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •