-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfaiss.pkl
45186 lines (18699 loc) · 777 KB
/
faiss.pkl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
��T �langchain.vectorstores.faiss�FAISS�)�}�(�embedding_function�builtins�getattr�langchain.embeddings.openai�OpenAIEmbeddings�)�}�(�__dict__�}�(�client�openai.api_resources.embedding� Embedding�document_model_name�text-embedding-ada-002�query_model_name�h�openai_api_key�Nu�__fields_set__�__private_attribute_values__�}�ub�embed_query�R�index�N�docstore�langchain.docstore.in_memory�InMemoryDocstore�)�}�_dict�}�(�$36ba7a93-c724-4f28-8f8d-256e208153e6�langchain.docstore.document�Document�)�}�(h}�(�page_content�X� search
Description
Use the search command to retrieve events from indexes or filter the results of a previous search command in the pipeline. You can retrieve events from your indexes, using keywords, quoted phrases, wildcards, and field-value expressions. The search command is implied at the beginning of any search. You do not need to specify the search command at the beginning of your search criteria.
You can also use the search command later in the search pipeline to filter the results from the previous command in the pipeline.
The search command can also be used in a subsearch. See about subsearches in the Search Manual.
After you retrieve events, you can apply commands to transform, filter, and report on the events. Use the vertical bar ( | ) , or pipe character, to apply a command to the retrieved events.
The search command supports IPv4 and IPv6 addresses and subnets that use CIDR notation.
Syntax
search <logical-expression>
Required arguments
<expression>
Syntax: <logical-expression> | <time-opts> | <search-modifier> | NOT <logical-expression> | <index-expression>
| <comparison-expression> | <logical-expression> [OR] <logical-expression>
Description: Includes all keywords or field-value pairs used to describe the events to retrieve from the index. Include parenthesis as necessary. Use Boolean expressions, comparison operators, time modifiers, search modifiers, or combinations of expressions for this argument.
The AND operator is always implied between terms and expressions. For example, web error is the same as web AND error. Specifying clientip=192.0.2.255 earliest=-1h@h is the same as clientip=192.0.2.255 AND earliest=-1h@h. So unless you want to include it for clarity reasons, you do not need to specify the AND operator.
Logical expression options
<comparison-expression>
Syntax: <field><comparison-operator><value> | <field> IN (<value-list>)
Description: Compare a field to a literal value or provide a list of values that can appear in the field.
<index-expression>�
lookup_str� �metadata�}�lookup_index�K uh�(h3h/�h}�ub�$9b5ff9fc-5b2d-44d5-8477-dfe174da26c3�h+)�}�(h}�(h/X Syntax: <field><comparison-operator><value> | <field> IN (<value-list>)
Description: Compare a field to a literal value or provide a list of values that can appear in the field.
<index-expression>
Syntax: "<string>" | <term> | <search-modifier>
Description: Describe the events you want to retrieve from the index using literal strings and search modifiers.
<time-opts>
Syntax: [<timeformat>] (<time-modifier>)...
Description: Describe the format of the starttime and endtime terms of the search. See Time options.
Comparison expression options
<comparison-operator>
Syntax: = | != | < | <= | > | >=
Description: You can use comparison operators when searching field/value pairs. Comparison expressions with the equal ( = ) or not equal ( != ) operator compare string values. For example, "1" does not match "1.0".
Comparison expressions with greater than or less than operators < > <= >= numerically compare two numbers and lexicographically compare other values. See Usage.
<field>
<value>
Syntax: <string>
Description: The name of a field.
Syntax: <literal-value>
Description: In comparison-expressions, the literal number or string value of a field.
<value-list>
Syntax: (<literal-value>, <literal-value>, ...)
Description: Used with the IN operator to specify two or more values. For example use error IN (400, 402, 404, 406) instead of error=400 OR error=402 OR error=404 OR error=406
Index expression options
<string>
Syntax: "<string>"
Description: Specify keywords or quoted phrases to match. When searching for strings and quoted strings (anything that's not a search modifier), Splunk software searches the _raw field for the matching events or results.
<search-modifier>
Syntax: <sourcetype-specifier> | <host-specifier> | <hosttag-specifier> | <source-specifier> |�h1h2h3}�h5K uh�(h3h/�h}�ub�$9bfbc638-dd6f-4525-9949-f0503133c70b�h+)�}�(h}�(h/X� <search-modifier>
Syntax: <sourcetype-specifier> | <host-specifier> | <hosttag-specifier> | <source-specifier> |
<savedsplunk-specifier> | <eventtype-specifier> | <eventtypetag-specifier> | <splunk_server-specifier> Description: Search for events from specified fields or field tags. For example, search for one or a combination of hosts, sources, source types, saved searches, and event types. Also, search for the field tag, with the format: tag::<field>=<string>.
Read more about searching with default fields in the Knowledge Manager manual.
Read more about using tags and field aliases in the Knowledge Manager manual.
<sourcetype-specifier>
Syntax: sourcetype=<string>
Description: Search for events from the specified sourcetype field.
<host-specifier>
Syntax: host=<string>
Description: Search for events from the specified host field.
<hosttag-specifier>
Syntax: hosttag=<string>
Description: Search for events that have hosts that are tagged by the string.
<eventtype-specifier>
Syntax: eventtype=<string>
Description: Search for events that match the specified event type.
<eventtypetag-specifier>
Syntax: eventtypetag=<string>
Description: Search for events that would match all eventtypes tagged by the string.
<savedsplunk-specifier>
Syntax: savedsearch=<string> | savedsplunk=<string>
Description: Search for events that would be found by the specified saved search.
<source-specifier>
Syntax: source=<string>
Description: Search for events from the specified source field.
<splunk_server-specifier>
Syntax: splunk_server=<string>
Description: Search for events from a specific server. Use "local" to refer to the search head.
Time options
For a list of time modifiers, see Time modifiers for search.
<timeformat>
Syntax: timeformat=<string>
Description: Set the time format for starttime and endtime terms.
Default: timeformat=%m/%d/%Y:%H:%M:%S.
<time-modifier>
Syntax: starttime=<string> | endtime=<string> | earliest=<time_modifier> | latest=<time_modifier>�h1h2h3}�h5K uh�(h3h/�h}�ub�$802b1255-1064-4d74-8faa-0b2bfac1003b�h+)�}�(h}�(h/X� Default: timeformat=%m/%d/%Y:%H:%M:%S.
<time-modifier>
Syntax: starttime=<string> | endtime=<string> | earliest=<time_modifier> | latest=<time_modifier>
Description: Specify start and end times using relative or absolute time.
starttime
Syntax: starttime=<string>
Description: Events must be later or equal to this time. Must match timeformat.
endtime
Usage
Syntax: endtime=<string>
Description: All events must be earlier or equal to this time.
The search command is an event-generating command when it is the first command in the search, before the first pipe. When the search command is used further down the pipeline, it is a distributable streaming command. See Command types.
A subsearch can be initiated through a search command such as the search command. See Initiating subsearches with search commands in the Splunk Cloud Platform Search Manual.
The implied search command
The search command is implied at the beginning of every search.
When search is the first command in the search, you can use terms such as keywords, phrases, fields, boolean expressions, and comparison expressions to specify exactly which events you want to retrieve from Splunk indexes. If you don't specify a field, the search looks for the terms in the the _raw field.
Some examples of search terms are:
• keywords: error login, which is the same as specifying for error AND login
• quoted phrases: "database error"
• boolean operators: login NOT (error OR fail)
• wildcards: fail*
• field-value pairs: status=404, status!=404, or status>200
See Use the search command in the Search Manual.
Using the search command later in the search pipeline
In addition to the implied search command at the beginning of all searches, you can use the search command later in the search pipeline. The search terms that you can use depend on which fields are passed into the search command.
If the _raw field is passed into the search command, you can use the same types of search terms as you can when the�h1h2h3}�h5K uh�(h3h/�h}�ub�$78b35ae8-7275-4bf6-a55d-772442fb7d17�h+)�}�(h}�(h/X� If the _raw field is passed into the search command, you can use the same types of search terms as you can when the
search command is the first command in a search.
However, if the _raw field is not passed into the search command, you must specify field-values pairs that match the fields passed into the search command. Transforming commands, such as stats and chart, do not pass the _raw field to the next command in the pipeline.
Boolean expressions
The order in which Boolean expressions are evaluated with the search is:
1. Expressions within parentheses
2. NOT clauses
3. OR clauses
4. AND clauses
This evaluation order is different than the order used with the where command. The where command evaluates AND clauses before OR clauses.
Comparing two fields
To compare two fields, do not specify index=myindex fieldA=fieldB or index=myindex fieldA!=fieldB with the search command. When specifying a comparison_expression, the search command expects a <field> compared with a <value>. The search command interprets fieldB as the value, and not as the name of a field.
Use the where command to compare two fields.
index=myindex | where fieldA=fieldB
For not equal comparisons, you can specify the criteria in several ways.
index=myindex | where fieldA!=fieldB
or
index=myindex | where NOT fieldA=fieldB
See Difference between NOT and != in the Search Manual.
Multiple field-value comparisons with the IN operator
Use the IN operator when you want to determine if a field contains one of several values.
For example, use this syntax:
... error_code IN (400, 402, 404, 406) | ...
Instead of this syntax:
... error_code=400 OR error_code=402 OR error_code=404 OR error_code=406 | ...
When used with the search command, you can use a wildcard character in the list of values for the IN operator. For example:
... error_code IN (40*) | ...
You can use the NOT operator with the IN operator. For example:
... NOT clientip IN (211.166.11.101, 182.236.164.11, 128.241.220.82) | ...�h1h2h3}�h5K uh�(h3h/�h}�ub�$9a68813a-98e8-4aee-9d21-852598f1a3e3�h+)�}�(h}�(h/X� ... error_code IN (40*) | ...
You can use the NOT operator with the IN operator. For example:
... NOT clientip IN (211.166.11.101, 182.236.164.11, 128.241.220.82) | ...
There is also an IN function that you can use with the eval and where commands. Wild card characters are not allowed in the values list when the IN function is used with the eval and where commands. See Comparison and Conditional functions.
CIDR matching
The search command can perform a CIDR match on a field that contains IPv4 and IPv6 addresses. Suppose the ip field contains these values:
10.10.10.12
50.10.10.17
10.10.10.23
If you specify ip="10.10.10.0/24", the search returns the events with the first and last values: 10.10.10.12 and 10.10.10.23.
Lexicographical order
Lexicographical order sorts items based on the values used to encode the items in computer memory. In Splunk software, this is almost always UTF-8 encoding, which is a superset of ASCII.
• Numbers are sorted before letters. Numbers are sorted based on the first digit. For example, the numbers 10, 9, 70, 100 are sorted lexicographically as 10, 100, 70, 9.
• Uppercase letters are sorted before lowercase letters.
• Symbols are not standard. Some symbols are sorted before numeric values. Other symbols are sorted before or after letters.
You can specify a custom sort order that overrides the lexicographical order. See the blog Order Up! Custom Sort Orders.
Quotes and escaping characters
In general, you need quotation marks around phrases and field values that include white spaces, commas, pipes, quotations, and brackets. Quotation marks must be balanced. An opening quotation must be followed by an unescaped closing quotation. For example:
• A search such as error | stats count will find the number of events containing the string error.
• A search such as ... | search "error | stats count" would return the raw events containing error, a pipe, stats, and count, in that order.�h1h2h3}�h5K uh�(h3h/�h}�ub�$35b3790c-3ea9-44b7-a07b-8b7292511027�h+)�}�(h}�(h/X� • A search such as ... | search "error | stats count" would return the raw events containing error, a pipe, stats, and count, in that order.
Additionally, you want to use quotation marks around keywords and phrases if you do not want to search for their default meaning, such as Boolean operators and field/value pairs. For example:
• A search for the keyword AND without meaning the Boolean operator: error "AND"
• A search for this field/value phrase: error "startswith=foo"
The backslash character ( \ ) is used to escape quotes, pipes, and itself. Backslash escape sequences are still expanded inside quotation marks. For example:
• The sequence \| as part of a search will send a pipe character to the command, instead of having the pipe split between commands.
• The sequence \" will send a literal quotation mark to the command, for example for searching for a literal quotation mark or inserting a literal quotation mark into a field using rex.
• The \\ sequence will be available as a literal backslash in the command.
Unrecognized backslash sequences are not altered:
• For example \s in a search string will be available as \s to the command, because \s is not a known escape sequence.
• However, in the search string \\s will be available as \s to the command, because \\ is a known escape sequence that is converted to \.
Search with TERM()
You can use the TERM() directive to force Splunk software to match whatever is inside the parentheses as a single term in the index. TERM is more useful when the term contains minor segmenters, such as periods, and is bounded by major segmenters, such as spaces or commas. In fact, TERM does not work for terms that are not bounded by major breakers.
See Use CASE and TERM to match phrases in the Search Manual.
Search with CASE()
You can use the CASE() directive to search for terms and field values that are case-sensitive. See Use CASE and TERM to match phrases in the Search Manual.
Examples�h1h2h3}�h5K uh�(h3h/�h}�ub�$bfb7faa1-89bb-4c5f-b2f8-d7a0a730014e�h+)�}�(h}�(h/X� Search with CASE()
You can use the CASE() directive to search for terms and field values that are case-sensitive. See Use CASE and TERM to match phrases in the Search Manual.
Examples
These examples demonstrate how to use the search command. You can find more examples in the Start Searching topic of the Search Tutorial.
1. Field-value pair matching
This example demonstrates field-value pair matching for specific values of source IP (src) and destination IP (dst).
src="10.9.165.*" OR dst="10.9.165.8"
2. Using boolean and comparison operators
This example demonstrates field-value pair matching with boolean and comparison operators. Search for events with code values of either 10 or 29, and any host that isn't "localhost", and an xqp value that is greater than 5.
(code=10 OR code=29) host!="localhost" xqp>5
In this example you could also use the IN operator since you are specifying two field-value pairs on the same field. The revised search is:
code IN(10, 29) host!="localhost" xqp>5
3. Using wildcards
This example demonstrates field-value pair matching with wildcards. Search for events from all the web servers that have an HTTP client or server error status.
host=webserver* (status=4* OR status=5*)
In this example you could also use the IN operator since you are specifying two field-value pairs on the same field. The revised search is:
host=webserver* status IN(4*, 5*)
4. Using the IN operator
This example shows how to use the IN operator to specify a list of field-value pair matchings. In the events from an access.log file, search the action field for the values addtocart or purchase.
sourcetype=access_combined_wcookie action IN (addtocart, purchase)
5. Specifying a secondary search
This example uses the search command twice. The search command is implied at the beginning of every search with the criteria eventtype=web-traffic. The search command is used again later in the search pipeline to filter out the results.�h1h2h3}�h5K uh�(h3h/�h}�ub�$997da8e4-b23e-425b-9e61-f137c47a3af8�h+)�}�(h}�(h/X� This search defines a web session using the transaction command and searches for the user sessions that contain more than three events.
eventtype=web-traffic | transaction clientip startswith="login" endswith="logout" | search eventcount>3
6. Using the NOT or != comparisons
Searching with the boolean "NOT"comparison operator is not the same as using the "!=" comparison. The following search returns everything except fieldA="value2", including all other fields.
NOT fieldA="value2"
The following search returns events where fieldA exists and does not have the value "value2".
fieldA!="value2"
If you use a wildcard for the value, NOT fieldA=* returns events where fieldA is null or undefined, and fieldA!=* never returns any events.
See Difference between NOT and != in the Search Manual.
7. Using search to perform CIDR matching
You can use the search command to match IPv4 and IPv6 addresses and subnets that use CIDR notation. For example, this search identifies whether the specified IPv4 address is located in the subnet.
| makeresults | eval ip="192.0.2.56" | search ip="192.0.2.0/24"
The IP address is located in the subnet, so search displays it in the search results, which look like this.
time ip
2020-11-19 16:43:31 192.0.2.56
Note that you can get identical results using the eval command with the cidrmatch("X",Y) function, as shown in this example.
| makeresults | eval ip="192.0.2.56" | where cidrmatch("192.0.2.0/24", ip)
Alternatively, if you're using IPv6 addresses, you can use the search command to identify whether the specified IPv6 address is located in the subnet.
| makeresults | eval ip="2001:0db8:ffff:ffff:ffff:ffff:ffff:ff99" | search ip="2001:0db8:ffff:ffff:ffff:ffff:ffff:ff00/120"
The IP address is in the subnet, so the search results look like this.
2020-11-19 16:43:31 2001:0db8:ffff:ffff:ffff:ffff:ffff:ff99
See also
Commands
iplocation lookup
Functions
cidrmatch
Introduction
Introduction�h1h2h3}�h5K uh�(h3h/�h}�ub�$cc79abaa-17fe-4dad-bf2a-f323ee0198f7�h+)�}�(h}�(h/XO 2020-11-19 16:43:31 2001:0db8:ffff:ffff:ffff:ffff:ffff:ff99
See also
Commands
iplocation lookup
Functions
cidrmatch
Introduction
Introduction
The Search Processing Language (SPL) is a set of commands that you use to search your data.
There are two versions of SPL: SPL and SPL, version 2 (SPL2). This manual describes SPL2. SPL2 is a product-agnostic
language that supports both SPL and SQL syntax patterns.
If you are looking for information about using SPL: For Splunk Cloud Platform, see Search Reference in the Splunk
Cloud Platform documentation. For Splunk Enterprise, see Search Reference in the Splunk Enterprise documentation.
Where SPL2 is used?
Several Splunk products use SPL2:
• Splunk Edge Processor
Splunk Data Stream Processor (DSP) uses a set of custom functions, some of which are similar to SPL2 commands and
functions. See DSP functions by category in the Splunk Data Stream Processor Function Reference.
Learning SPL2
SPL2 makes the search language easier to use, removes infrequently used commands, and improves the consistency of
the command syntax.
There are two Splunk manuals that contain information about SPL2:
SPL2 Search Reference
command syntax, data types, and functions.
SPL2 Search Manual
get started searching, how to use expressions and predicates, even how to add comments to your search strings.
Useful links to SPL2 documentation
The following list contains links to SPL2 getting started and quick reference information:
• Understanding SPL2 Syntax
• SPL2 eval functions Quick Reference
• Start searching using SPL2 in the SPL2 Search Manual
• Types of expressions in the SPL2 Search Manual
1
• New features in SPL2
Understanding SPL2 Syntax
The following sections describe the syntax used for the Search Processing Language version 2 (SPL2) commands.
Required and optional arguments
SPL2 commands consist of required and optional arguments.
• Required arguments are shown in angle brackets < >.
Consider this command syntax:
bin�h1h2h3}�h5K uh�(h3h/�h}�ub�$509be07b-881a-4ae7-828f-f38be117a76a�h+)�}�(h}�(h/X Required and optional arguments
SPL2 commands consist of required and optional arguments.
• Required arguments are shown in angle brackets < >.
Consider this command syntax:
bin
[<bin-options>...]
The required argument is <field>. To use this command, at a minimum you must specify bin <field>.
The optional arguments are [<bin-options>...] and [AS <newfield>].
User input arguments
Consider this command syntax:
replace (<string> WITH <string>)... [IN <field-list>]
The user input arguments are: <string> and <field-list>.
Repeating arguments
Some arguments can be specified multiple times. The syntax displays ellipsis ... to specify which part of an argument can
be repeated. The ellipsis always appear immediately after the part of the syntax that you can repeat.
Consider this command:
eval <field>=<expression>["," <field>=<expression>]...
The required argument is <field>=<expression>.
For example, for one expression you would specify this:
eval <field>=<expression>
The optional arguments are inside the the square brackets. The ellipsis at the end of the syntax, just after the close
square bracket, indicate that you can repeat whatever is inside the square brackets as many times as you want to.
In this example, you have the option to specify more than one field expression. Each expression must be separated by
comma. For example, to specify three field expressions the syntax would look like this:
2
eval <field>=<expression>, <field>=<expression>, <field>=<expression>
In the following syntax, you can repeat the <bin-options>....
bin [<bin-options>...] <field> [AS <newfield>]
Grouped arguments
Sometimes the syntax must display arguments as a group to show that the set of arguments are used together or that
there are alternative parts to an argument.
Parenthesis ( ) are used to group arguments.
For example, consider this syntax:
| (FROM | from) <dataset>
[ (GROUP BY | GROUPBY | BY) [ <field>[,<field>... ]�h1h2h3}�h5K uh�(h3h/�h}�ub�$8b3ed02d-4ed2-4fe3-847a-9db44b6dbb59�h+)�}�(h}�(h/X� Parenthesis ( ) are used to group arguments.
For example, consider this syntax:
| (FROM | from) <dataset>
[ (GROUP BY | GROUPBY | BY) [ <field>[,<field>... ]
[ (SELECT | SELECT DISTINCT) <expr>[,<expr>...]
[ LIMIT <integer> ]
[ OFFSET <integer> ]
Let's look at the GROUP BY clause.
[ (GROUP BY | GROUPBY | BY) [ <field>[,<field>... ]
There are several sets of parentheses.
(GROUP BY | GROUPBY | BY)
* GROUP BY
* GROUPBY
* BY
( SPAN <field>,<int><timescale> | <field> SPAN=<int><timescale> )
* SPAN <field>,<int><timescale>
* <field> SPAN=<int><timescale>
Keywords
Many commands use keywords with some of the arguments or options. Examples of keywords include:
• AS
• BY
You can specify these keywords in uppercase or lowercase in your search. However, for readability, the syntax in the
Splunk documentation uses uppercase on all keywords.
3
Renaming fields
The AS keyword is used to rename a field using the syntax AS <field>. The name you specify for the field can't be a
reserved word. For a list of the reserved words, see Reserved words in this topic.
Quoted elements
If an element is in quotation marks in syntax, you must include that element in your search. The most common quoted
elements are parenthesis and commas.
Consider the syntax for the head command:
head
[null = (true | false)]
[N]
There are quotation marks on the parenthesis surrounding the boolean-expression>. This means that you must enclose
the <boolean-expression> in parenthesis in your search.
In the following search example, the <eval-expression> is avg(size)/max(delay) and is enclosed in parenthesis.
... | streamstats range(_time) as timerange | head while (timerange<100)
Syntax descriptions
In the command syntax, the command options must be specified before the command arguments..
In the Syntax details section for each command, the Required arguments and Optional argument sections list the�h1h2h3}�h5K uh�(h3h/�h}�ub�$f2177d58-9d6a-42c6-a195-dd3af37eb0a1�h+)�}�(h}�(h/X� In the Syntax details section for each command, the Required arguments and Optional argument sections list the
arguments alphabetically. For each argument, there is a Syntax and Description. Additionally, for Optional arguments,
there might be a Default.
Logical operators
Logical operators are words that you use in an expression to search for terms that match, or don't match, a condition. The
result of the expression is either TRUE or FALSE.
When a logical operator is included in the syntax of a command, you must always specify the operator in uppercase.
Supported logical operators
The supported logical operators are:
• AND
• OR
• XOR
In addition to logical operators, there are other operators that you can use in expressions. See Predicate expressions in
the SPL2 Search Manual.
4
BY clauses
A <by-clause> and a <split-by-clause> are not the same argument.
When you use a <by-clause>, one row is returned for each distinct value <by-clause> field. A <by-clause> displays each
unique item in a separate row. Think of the <by-clause> as a grouping.
The <split-by-clause> displays each unique item in a separate column. Think of the <split-by-clause> as a splitting or
dividing.
Wildcard characters ( * ) are not accepted in BY clauses.
Fields and wildcard fields
When the syntax contains <field> you specify a field name from your events.
Consider this syntax:
bin [<bin-options>...] <field> [AS <newfield>]
The <field> argument is required. You can specify that the field displays a different name in the search results by using
the [AS <newfield>] argument. This argument is optional.
For example, if the field is categoryId and you want the field to be named CategoryID in the output, you would specify:
categoryId AS CategoryID
Field names and quotation marks
Field names that begin with anything other than a-z, A-Z, or the underscore ( _ ) character must be enclosed in single
quotation marks ( ' ).�h1h2h3}�h5K uh�(h3h/�h}�ub�$ceafdc08-86df-4e34-b124-3cf94bdd1d6a�h+)�}�(h}�(h/X� Field names and quotation marks
Field names that begin with anything other than a-z, A-Z, or the underscore ( _ ) character must be enclosed in single
quotation marks ( ' ).
Field names that contain anything other than a-z, A-Z, 0-9, or the underscore ( _ ) character must be enclosed in single
quotation marks ( ' ). This includes the wildcard ( * ) character, the dash ( - ), and the space character.
Reserved words
Some words are reserved for the SPL2 syntax and have predefined meanings in the language.
You cannot use reserved words for identifiers such as field names, dataset names, function names, and so forth.
However, you can use a reserved word if you enclose the word in single quotation marks. For example, you can't use
dedup for a field name but you can use 'dedup'.
Here's a list of the reserved words in SPL2:
after
and,
apply
as,
asc,
5
AND
AS
ASC
between,
by,
before
bin
branch
BETWEEN
BY
desc,
distinct,
dedup
eval
eventstats
DESC
DISTINCT
exists,
from,
export
false
fit
EXISTS
FROM
group,
groupby,
having,
function
head
GROUP
GROUPBY
HAVING
in,
inner,
histperc
import
into
IN
INNER
is,
join,
left,
like,
limit,
IS
JOIN
LEFT
LIKE
LIMIT
not,
null,
offset,
on,
lookup
NOT
NULL
OFFSET
ON
or,
order,
orderby,
outer,
onchange
OR
ORDER
ORDERBY
OUTER
OUTPUT
OUTPUTNEW
rename
reset
return
select,
rex
search
sort
stats
SELECT
thru,