Find the answer to your Linux question:
Results 1 to 6 of 6
Hi All, I have a situation where there is a log file which is being written by the running application every millisecond and is of huge size. Now i have ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Oct 2012
    Posts
    3

    GREP not working in log file


    Hi All,

    I have a situation where there is a log file which is being written by the running application every millisecond and is of huge size.

    Now i have to test something and for that i have to append some string that log file. So tried to run below command :

    /> echo "my string appended" >> test.log

    then i wanted to confirm that whether the string has been appended or not, so ran the below command :

    /> grep "my string appended" test.log

    But it returned nothing. Though as per my knowledge it should have returned the string appended.

    Is it because that test.log is being written simultaneously by the application?
    Is above the right approach or not?

    Please correct me in my approach.

    Thanks a lot in advance.

  2. #2
    Linux Newbie
    Join Date
    Apr 2012
    Posts
    129
    If you are typing it in as is remove the "/>" and should work

  3. #3
    Just Joined!
    Join Date
    Oct 2012
    Posts
    3
    Quote Originally Posted by Alpha90 View Post
    If you are typing it in as is remove the "/>" and should work
    Hi Aplha90, thanks for reply.

    Actually "/>", i meant command line. I think i should have excluded that.

  4. #4
    Linux Newbie
    Join Date
    Apr 2012
    Posts
    112
    Quote Originally Posted by itsumesh View Post
    Hi Aplha90, thanks for reply.

    Actually "/>", i meant command line. I think i should have excluded that.
    I imagine you've thought about this and discarded it due to excessive mem use, perhaps?

    Code:
    cat test.log | grep  "my string appended"

  5. #5
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,317
    Does your user have permission to write to the log file?
    What do we want?
    Time machines!

    When do we want 'em?
    Doesn't really matter does it!?


    Conkybots: Interactive plugins for your Conkys!

  6. #6
    Just Joined!
    Join Date
    Oct 2012
    Posts
    3
    Yes my user has permission to write in log file

Posting Permissions

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