Filewatcher File Search File Search
Catalog
Content Search
» » » » » grok_1.20110708.1-4_s390x.deb » Content »
pkg://grok_1.20110708.1-4_s390x.deb:91022/usr/share/doc/grok/  info  control  downloads

grok - powerful pattern-matching and reacting tool…  more info»

README.examples

About these examples
====================

They should be usable, but may require extra installed dependencies.
You can try them by running the command "grok -f /path/to/file.grok".

examples/filter-example.grok
---------------------------

 - This demonstrates the built in transforms in grok, quoting a string
   to be safe for usage in a shell, and for json output.

 - It is also a handy example for watching how to do several actions
   on one line of input.

,----[ output ]
| $ grok -f examples/filter-example.grok 
| Shell escaped: \$something \"testing\"
| json: { myvalue: "$something \"testing\"" }
| $something "testing"
`----

examples/errorlogcheck.grok
---------------------------

 - This requires the executable "since", which is available in the
   package with the same name.

 - It will run "since" on /var/log/messages, which outputs any lines
   since the last invocation, and notify you if any of the log lines
   match the string "error". It will then stop on the first match.

examples/ifconfig.grok, examples.ip-predicate.grok
--------------------------------------------------

 - These seem to be the same file.

 - They will run "ifconfig", and use the built-in library of regular
   expressions to match IP addresses in the output.

,----[ output ]
| $ grok -f examples/ip-predicate.grok 
| Found: 192.0.2.254
| Found: 127.0.0.1
`----

examples/execrestart.grok
-------------------------

 - Runs a command. The match block will restart the command after 5
   seconds. This will run until killed.

,----[ output ]
| $ grok -f examples/execrestart.grok 
| Mon Jun  4 00:00:17 CEST 2012
| Mon Jun  4 00:00:22 CEST 2012
| Mon Jun  4 00:00:27 CEST 2012
| ^C
`----

examples/number-predicate2.grok
-------------------------------

 - This uses a regular expression called NUMBER from the library, and
   matches every input against it. If it matches, and is bigger than
   20, we get output.

,----[ output ]
| $ grok -f examples/number-predicate2.grok 
| Got number: 33
`----

examples/nuberpredicate.grok
----------------------------

 - Runs the command "seq 25", and outputs all numbers higher than 20

,----[ output ]
| $ grok -f examples/numberpredicate.grok 
| Found: 21
| Found: 22
| Found: 23
| Found: 24
| Found: 25
`----
Results 1 - 1 of 1
Help - FTP Sites List - Software Dir.
Search over 15 billion files
© 1997-2017 FileWatcher.com