官术网_书友最值得收藏!

About the pipe symbol

Before we pe into the actual commands, it is important to understand what the pipe symbol (|) is used for in Splunk. In a command line, the pipe symbol is used to represent the sending of data from one process to another. For example, in a Unix-style operating system, you might say:

grep foo access.log | grep bar

The first command finds, in the file access.log, lines that contain foo. Its output is taken and piped to the input of the next grep command, which finds lines that contain bar. The final output goes wherever it was destined, usually to the terminal window.

The pipe symbol is different in Splunk in a few important ways:

  • Unlike the command line, events are not simply text, but rather each is a set of key/value pairs. You can think of each event as a database row, a Python dictionary, a JavaScript object, a Java map, or a Perl associative array. Some fields are hidden from the user but are available for use. Many of these hidden fields are prefixed with an underscore; for instance _raw, which contains the original event text, and _time, which contains the parsed time in UTC epoch form. Unlike a database, events do not adhere to a schema, and fields are created dynamically.
  • Commands can do anything to the events that they are handed. Usually, a command does one of the following:
    • Modifies or creates fields—for example, eval, rex
    • Filters events—for example, head, where
    • Replaces events with a report—for example, top, stats
    • Sorts the results of a search—using sort
  • Some commands can act as generators, which produce what you might call synthetic events, such as |metadata and |inputcsv.

We will get to know the pipe symbol very well through examples.

主站蜘蛛池模板: 寻乌县| 岢岚县| 年辖:市辖区| 象州县| 富源县| 灵川县| 泉州市| 永清县| 泸西县| 上高县| 西和县| 安义县| 华宁县| 连云港市| 临夏市| 且末县| 思南县| 黄浦区| 柳州市| 岳普湖县| 闽侯县| 白银市| 方正县| 远安县| 长寿区| 临潭县| 城固县| 砚山县| 拉萨市| 凤城市| 临夏市| 大荔县| 南澳县| 昂仁县| 浦县| 保康县| 吉林市| 蛟河市| 德令哈市| 汉源县| 保靖县|