OpenAI
Synopsis
Enriches events by sending field content to OpenAI's API for analysis and stores the response.
Schema
openai:
- field: <ident>
- api_key: <string>
- target_field: <ident>
- system_msg: <string>
- description: <text>
- if: <script>
- ignore_failure: <boolean>
- ignore_missing: <boolean>
- model: <string>
- temperature: <number>
- max_tokens: <number>
- on_failure: <processor[]>
- on_success: <processor[]>
- tag: <string>
Configuration
Field | Required | Default | Description |
---|---|---|---|
field | Y | - | Field containing content to analyze |
api_key | Y | - | OpenAI API key for authentication |
target_field | N | field | Field to store the API response |
system_msg | N | - | System context message for the AI |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | Continue if API call fails |
ignore_missing | N | false | Continue if source field doesn't exist |
model | N | gpt-3.5-turbo | OpenAI model to use |
temperature | N | 0.7 | Response randomness (0-1) |
max_tokens | N | 1000 | Maximum response length |
on_failure | N | - | See Handling Failures |
on_success | N | - | See Handling Success |
tag | N | - | Identifier |
Details
This processor is useful for automated analysis, context enrichment, and intelligent processing of log data. It supports system context messages generated for analysis, temperature control for response variation, and token limits for response length management.
System messages help guide the AI's analysis.
Multiple models can be accessed, and responses can be configured. Lower temperature values produce more focused responses.
Token limits control response length and costs. Consider rate limits and costs for high-volume processing, as long input texts may hit token limits.
API responses are cached to improve performance since API calls add latency to event processing.
Error recovery options and success/failure handing are also available.
API keys should be securely stored and accessed.
Examples
Basic
Analyzing a Cisco device log... |
|
adds information to the event: |
|
Precision
Fine-tuning analysis parameters... |
|
produces more focused security insights: |
|
Conditionals
Analyzing only critical errors... |
|
is preferable due to level: |
|
Error Handling
Anticipating API failures... |
|
continues execution: |
|