Ad Widget

Collapse

Discard text lines and multi-line filter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • markfree
    Senior Member
    • Apr 2019
    • 868

    #1

    Discard text lines and multi-line filter

    I have an item that retrieves text data where the first few lines are not necessary.
    Something like this:
    Code:
    DISCARD TEXT
    DISCARD TEXT
    DISCARD TEXT
    DISCARD TEXT
    DISCARD TEXT
    TEXT TO KEEP
    TEXT TO KEEP
    TEXT TO KEEP
    TEXT TO KEEP
    TEXT TO KEEP
    DISCARD TEXT

    DISCARD TEXT" is repeated only for this example.

    There is no preprocessing step to discard multiple lines of text. I still wonder why not...
    With that example, if I try to capture the "TEXT" expression with a Regex, only the first term from "DISCARD TEXT" would be found since there's no global flag.


    So, with all that, is there any suggestion on how to discard text lines and correctly filter a multi-line text?
    Do I really have to resort to Javascript?​
  • cyber
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Dec 2006
    • 4807

    #2
    Most of log items are meant to work line by line, so they wont even return multiple lines at once... vfs.file.contents seems to be only one to retrieve file contents. (up to 64k size). And with that you really might need to go to JS preprocessing..
    Other option would be a UserParameter, which does that discarding before fetching file contents (grep) ... ​

    Comment

    Working...