Symbols
Identify the source code/binary executable origin of symbol values within TenXTemplate hidden classes.
Identifying where each symbol value originated from within TenXTemplates enables reflective programming wherein TenXObjects can inspect their structure and member types and source code/executable file origin.
Each symbol lists its file of origin (e.g., foo.js, sudo, acme.dll) and the context in which it appears in it (e.g., class/func/enum name, string format..).
Source code/executable origin information is accessible at run time via the symbol, symbolSequence, and symbolOrigin functions.
this.class = this.symbol("class");
this.sequence = this.symbolSequence("log,exec");
this.origin = this.symbolOrigin("log,exec");
For the following Apache Spark log event:
17/06/09 20:10:42 INFO executor.CoarseGrainedExecutorBackend: Connecting to driver: spark://CoarseGrainedScheduler@10.10.34.11:48069
| Field | Value |
|---|---|
| class | CoarseGrainedExecutorBackend |
| sequence | Connecting to driver |
| origin | CoarseGrainedExecutorBackend.scala |
For the following Unix log event:
Jun 14 15:16:02 combo sshd(pam_unix)[19937]: authentication failure; logname= uid=0 euid=0 tty=NODEVssh ruser= rhost=218.188.2.4
| Field | Value |
|---|---|
| class | "" |
| sequence | authentication failure |
| origin | sshd |
Contexts
Compile scanners assigns each extracted symbol value within a target source code/binary file a context which describes its meaning and position within the file.
Supported contexts include:
package
Source code package/namespace name. For example:
class
Source code class/interface definition. For example:
The scanner will capture AcmeServer, AcmeClient as class symbols.
The scanner will capture com.acme.client.core, MyCompany.Proj1 as package symbols.
method
Source code method/function name. For example:
The scanner will capture hostError, get_name as method symbols
enum
Source code enum literal value. For example:
The scanner will capture:
- OK, FAIL, RETRY as enum symbols
- STATUS as a class symbol
log
Source code constant arg within a logging method. For example:
function hostError(host) {
//The "error connecting" symbol passes as an indirect arg to the logger
var msg = fmtError("error connecting", host);
console.error(msg);
}
The scanner will capture error connecting as a log symbol.
const
Source code constant value assigned to a variable, parameter or code annotation. For example:
The scanner will capture price, state, key as a const symbol.
exec
Symbol captured from a custom program or OS command via the executable symbol scanner (e.g., strings).
For example:
The scanner will capture Authentication failure message %s as an exec symbol.
text
Config field name/value captured from file (e.g., .xml, .json) via the text symbol scanner.
For example:
The scanner will capture the field names spring, name, and environment as text symbols.
The test and testing field values are only captured as text if the textScanFieldValues is set to true.
Configuration
To configure the Origin selector unit, Edit these settings.
Below is the default configuration from: symbol/config.yaml.
ewogICJ0eXBlIiA6ICJvYmplY3QiLAogICJwcm9wZXJ0aWVzIiA6IHsKICAgICJ0ZW54IiA6IHsKICAgICAgInR5cGUiIDogInN0cmluZyIKICAgIH0sCiAgICAic3ltYm9sIiA6IHsKICAgICAgInR5cGUiIDogIm9iamVjdCIsCiAgICAgICJhZGRpdGlvbmFsUHJvcGVydGllcyIgOiBmYWxzZSwKICAgICAgInByb3BlcnRpZXMiIDogewogICAgICAgICJzZXF1ZW5jZVJlc2VydmVkIiA6IHsKICAgICAgICAgICJ0eXBlIiA6IFsKICAgICAgICAgICAgImFycmF5IiwKICAgICAgICAgICAgIm51bGwiCiAgICAgICAgICBdLAogICAgICAgICAgIm1hcmtkb3duRGVzY3JpcHRpb24iIDogIkxpc3Qgb2YgdGVybXMgdG8gaWdub3JlIHdoZW4gc2Nhbm5pbmcgc3ltYm9sIHRva2Vuc1xuXG5EZWZpbmVzIGEgbGlzdCBvZiB0ZXJtcyB0aGF0IHRvIGlnbm9yZSB3aGVuIHNlYXJjaGluZyBmb3IgdGhlIHN5bWJvbCB0b2tlbnMgY29uc3RpdHV0aW5nIGFuIFRlblhUZW1wbGF0ZSdzICdtZXNzYWdlJyBwb3J0aW9uIChpLmUuLCB0aGUgbG9uZ2VzdCBjb25zZWN1dGl2ZSBzZXF1ZW5jZSBvZiBbc3ltYm9sXShodHRwczovL2RvYy5sb2cxMHguY29tL3J1bi90cmFuc2Zvcm0vc3RydWN0dXJlLyNzeW1ib2xzKSB0b2tlbnMpLiBGb3IgZXhhbXBsZSwgZm9yIGFuIFRlblhPYmplY3Qgd2hvc2UgdGV4dCBjb250YWluczogJ2Nvbm5lY3Qgc3VjY2VzcyA9IHRydWUnLCB0aGUgdmFsdWUgJ3RydWUnIHdpbGwgbm90IGJlIGNvbnNpZGVyZ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hbHVlcyBmb3IgYSB0YXJnZXQgVGVuWFRlbXBsYXRlIHN5bWJvbCBzZXF1ZW5jZS4gIFNwZWNpZnkgJyonIGZvciBhbGwgc3ltYm9scy4iLAogICAgICAgICAgICAgICJpdGVtcyIgOiB7CiAgICAgICAgICAgICAgICAidHlwZSIgOiAic3RyaW5nIgogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfSwKICAgICAgICAgICAgImxvZ2dlck5hbWUiIDogewogICAgICAgICAgICAgICJ0eXBlIiA6IFsKICAgICAgICAgICAgICAgICJzdHJpbmciLAogICAgICAgICAgICAgICAgIm51bGwiCiAgICAgICAgICAgICAgXSwKICAgICAgICAgICAgICAibWFya2Rvd25EZXNjcmlwdGlvbiIgOiAiRGVidWcgbG9nZ2VyIG5hbWVcblxuQ29udHJvbHMgdGhlIG5hbWUgb2YgdGhlIGxvZzRqIGxvZ2dlciB1c2VkIGJ5IFtkZWJ1Z09yaWdpbnNdKGh0dHBzOi8vZG9jLmxvZzEweC5jb20vcnVuL3RyYW5zZm9ybS9zeW1ib2wvI3N5bWJvbGRlYnVnb3JpZ2lucykgYW5kIFtkZWJ1Z1N5bWJvbHNdKGh0dHBzOi8vZG9jLmxvZzEweC5jb20vcnVuL3RyYW5zZm9ybS9zeW1ib2wvI3N5bWJvbGRlYnVnc3ltYm9scykuIChEZWZhdWx0OiBbY29uc29sZU91dF0oaHR0cHM6Ly9naXRodWIuY29tL2xvZy0xMHgvY29uZmlnL2Jsb2IvbWFpbi9sb2c0ajIueWFtbCNMNjYpKSIsCiAgICAgICAgICAgICAgImRlZmF1bHQiIDogIltjb25zb2xlT3V0XShodHRwczovL2dpdGh1Yi5jb20vbG9nLTEweC9jb25maWcvYmxvYi9tYWluL2xvZzRqMi55YW1sI0w2NikiCiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgIH0KICB9LAogICJhZGRpdGlvbmFsUHJvcGVydGllcyIgOiBmYWxzZQp9
# 🔟❎ 'run' symbol origin configuration
# Identify the origin of symbol values within TenXTemplates.
# To learn more see https://doc.log10x.com/run/transform/symbol/
# Set the 10x pipeline to 'run'
tenx: run
# =============================== Origin Options ==============================
symbol:
# 'maxOrigins' controls the number of source/binary origins to list
# per symbol token sequence. As a series of tokens within
# a target TenXTemplate (e.g., 'ERROR', 'could not connect to "{}') may appear
# in multiple source/binary files within the pipeline's loaded library.
# The sorting algorithm configured below is used to select the 'maxSymbolOrigins'
# topmost entries to list.
maxOrigins: 64
# 'sequenceReserved' defines a list of terms to ignore when searching
# for the symbol tokens that constitute an TenXTemplate's 'message' portion.
# For example, for an event whose text contains: 'connect success = true',
# the value 'true' will not be considered a part of the event's message,
# as the 'true' value is mostly likely the result of a variable boolean state.
# For more information, see: https://doc.log10x.com/api/js/#TenXObject+symbolSequence
sequenceReserved:
- "null"
- "nil"
- "true"
- "false"
- "to"
- "the"
- "a"
- "at"
- "for"
- "log"
- "info"
- "http"
- TRACE
- DEBUG
- INFO
- NOTICE
- WARN
- ERROR
- CRITICAL
- ALERT
- EMERGENCY
# ----------------------------- Debug Options -------------------------------
debug:
# 'symbol' debugging allows for verbose printing of the selection process
# for symbol tokens from the pipeline's 10x symbol files used to produce the
# results of 10x reflection functions.
# For more information, see: https://doc.log10x.com/api/js/#TenXObject+symbol
# 'origins' outputs information about the origin selection process for an TenXTemplate symbol.
# For example, setting 'units' to 'foo.js' will output information about if/how it
# was selected as the origin of TenXTemplate symbols.
# In other words, if a symbol (e.g., 'MyClass') has 'foo.java' as the source file
# from which it originated, adding 'foo.js' to 'units' will emit information
# about the selection process.
# Specifying '*' will emit information for all source /binary files that have
# been selected as the origin of any TenXTemplate objects within the pipeline.
origins: [
# '*'
]
# 'symbols' logs the origin selection process for symbol tokens within an TenXTemplate.
# For example, set 'symbols' to 'Could not connect to' to log how the 10x JavaScript 'symbolSequence'
# determines the origin source code/binary file within the pipeline's symbol library.
# Specifying '*' will emit information for all source code /binary files that have
# been selected as the origin of any TenXTemplate objects within the pipeline.
symbols: [
# '*'
]
Options
Specify the options below to configure the Origin selector:
| Name | Description | Category |
|---|---|---|
| symbolSequenceReserved | List of terms to ignore when scanning symbol tokens | Symbol |
| symbolMaxOrigins | Max number of source/binary origins to list per symbol | Symbol |
| symbolDebugOrigins | List of source scanned file names for which to log information | Debug |
| symbolDebugSymbols | List of TenXTemplate symbol values for which to log information | Debug |
| symbolDebugLoggerName | Debug logger name | Debug |
Symbol
symbolSequenceReserved
List of terms to ignore when scanning symbol tokens.
| Type | Default | Category |
|---|---|---|
| List | [null, nil, true, false] | Symbol |
Defines a list of terms that to ignore when searching for the symbol tokens constituting an TenXTemplate's 'message' portion (i.e., the longest consecutive sequence of symbol tokens). For example, for an TenXObject whose text contains: 'connect success = true', the value 'true' will not be considered a part of the instance's message, as it is mostly likely the result of a variable boolean state. To learn more see symbolSequence.
symbolMaxOrigins
Max number of source/binary origins to list per symbol.
| Type | Default | Category |
|---|---|---|
| Number | 64 | Symbol |
Controls the number of source code/binary origins to list per symbol token sequence. As a series of tokens within a given template (e.g., 'ERROR', 'could not connect to "{}') may appear in multiple source/binary files within the pipeline's symbol files, the sorting algorithm selects maxSymbolOrigins for comparison.
Debug
symbolDebugOrigins
List of source scanned file names for which to log information.
| Type | Default | Category |
|---|---|---|
| List | [] | Debug |
Specifies a list of input file names within the loaded symbol library (e.g., 'my.scala', 'foo.java') for which to log information on if/how they participate in selecting the origin of a target TenXTemplate symbol sequence. This option helps debug how the symbolSequence function selects origin values for a target TenXTemplate symbol sequence.
Specify '*' for all input files.
symbolDebugSymbols
List of TenXTemplate symbol values for which to log information.
| Type | Default | Category |
|---|---|---|
| List | [] | Debug |
List of symbol values such as class and method names(e.g., 'MyClass', 'foo') for which to log information on how their origin information is selected. This option helps debug how the symbolSequence function selects origin values for a target TenXTemplate symbol sequence.
Specify '*' for all symbols.
symbolDebugLoggerName
Debug logger name.
| Type | Default | Category |
|---|---|---|
| String | consoleOut | Debug |
Controls the name of the log4j logger used by debugOrigins and debugSymbols.
This unit is defined in symbol/unit.yaml.