SIEM Hedefleri için Elasticsearch Index Şablonları
Bu sayfa Yönetim → Sistem Ayarları → SIEM ve Log Yönlendirme hedeflerinde konnektör olarak Elasticsearch seçildiğinde gerekir. Apinizer bu index'lerin şablonunu oluşturmaz; Elasticsearch kümesinin sahibi kurum oluşturur ve yönetir. Hedef ayarları için SIEM ve Log Yönlendirme sayfasına bakabilirsiniz.
Bağlantı Tanımı
SIEM hedefinin Elasticsearch bağlantısı için aşağıdaki kuralları uygulayın.
Cluster Yönetimi anahtarı açık bırakılırsa Apinizer bu bağlantıya API trafik logunun ILM politikasını, index şablonunu ve data stream'ini kurar. SIEM dokümanları @timestamp taşımadığı için o data stream HER kaydı reddeder. Legacy Raw hedefte kayıp sessizdir; v2 hedefte kayıt send_failed olarak sayılır. Şablonu, ILM politikasını ve data stream'i bu sayfadaki komutlarla kurum oluşturur ve yönetir.
- Tür:
ReadWriteseçin.Readseçilirse yazma yapılmaz. Legacy Raw hedefte kayıp SESSİZDİR: Teslim Sağlığı yeşil kalır, hata yalnızca uygulama logunda görünür. v2 hedefte kayıtsend_failedolarak sayılır. - Cluster Yönetimi: "Kümeyi (cluster) yönetmek için etkinleştiriniz" anahtarını KAPALI bırakın.
- Indeks Adı: Aşağıda oluşturduğunuz data stream adını girin (örneğin
apinizer-siem-v2). API trafik logunun index adı (apinizer-log-apiproxy-...) KULLANILMAMALIDIR; aksi hâlde trafik ve SIEM kayıtları aynı index'te karışır. - Bir bağlantı tek index'e yazar. Legacy Raw'da her hat için ayrı bağlantı ve ayrı hedef açın (aşağıdaki tabloya bakın). Şema v2'de tüm hatlar tek zarfı paylaşır; tek bağlantı ve tek index yeterlidir.
- Aynı bağlantı birden fazla hedef tarafından kullanılabilir. Legacy Raw hedefinin bağlantısı v2 hedefine VERİLMEMELİDİR, çünkü mapping farklıdır.
Yük Profiline Göre Index
| Yük profili | Hat | Index şablonu | Data stream (Indeks Adı) |
|---|---|---|---|
| Apinizer JSON v2 | Tüm hatlar (Denetim, Oturum, Token, Uygulama, API Güvenliği, API Erişimi, Portal) | apinizer-siem-v2-template | apinizer-siem-v2 |
| Legacy Raw | Denetim | apinizer-siem-audit-template | apinizer-siem-audit |
| Legacy Raw | Oturum | apinizer-siem-session-template | apinizer-siem-session |
| Legacy Raw | Token | apinizer-siem-token-template | apinizer-siem-token |
| Legacy Raw | Uygulama | apinizer-siem-application-template | apinizer-siem-application |
API Güvenliği, API Erişimi ve Portal hatları Legacy Raw ile gönderilemez; bu hatlar için v2 şablonunu kullanın. Legacy Raw alan listesi dondurulmuştur. v2 zarfına sonraki sürümlerde schemaVersion artmadan alan eklenebilir. Şablonlar bu yüzden dynamic_templates ile bilinmeyen metin alanlarını keyword olarak kabul eder.
Adım 1: Ingest Pipeline
Bu pipeline ZORUNLUDUR. SIEM dokümanları @timestamp taşımaz ve data stream, @timestamp olmayan her kaydı reddeder. Pipeline olay zamanını @timestamp alanına kopyalar; olay zamanı yoksa alınma zamanını yazar. Tek pipeline, beş şablonun hepsinde index.default_pipeline olarak kullanılır.
PUT _ingest/pipeline/apinizer-siem-timestamp
{
"description": "Apinizer SIEM: copy the event time into @timestamp",
"processors": [
{ "set": { "field": "@timestamp", "value": "{{timestamp}}", "override": false, "if": "ctx.timestamp != null" } },
{ "set": { "field": "@timestamp", "value": "{{auditEventDate}}", "override": false, "if": "ctx.auditEventDate != null" } },
{ "set": { "field": "@timestamp", "value": "{{eventDate}}", "override": false, "if": "ctx.eventDate != null" } },
{ "set": { "field": "@timestamp", "value": "{{date}}", "override": false, "if": "ctx.date != null" } },
{ "set": { "field": "@timestamp", "value": "{{_ingest.timestamp}}", "override": false } }
]
}
Adım 2: ILM Politikası
Aşağıdaki örnek politika 30 GB veya 1 gün dolunca rollover yapar ve 90 gün sonra veriyi siler. Değerleri kurumunuzun saklama gereksinimine göre belirleyin.
PUT _ilm/policy/apinizer-siem-ilm
{
"policy": {
"phases": {
"hot": {
"actions": {
"rollover": {
"max_size": "30gb",
"max_age": "1d"
}
}
},
"delete": {
"min_age": "90d",
"actions": {
"delete": {}
}
}
}
}
}
Adım 3: Index Şablonları
Hedefinizin yük profiline ve hattına uygun şablonu oluşturun. Her şablon aynı pipeline'ı ve aynı ILM politikasını kullanır.
Alan tiplerini DEĞİŞTİRMEYİN. data.changes ve data.reference serbest yapıdadır ve flattened olarak eşlenir. referenceObjectJson, changesJson, toClientBody ve stackTrace gibi büyük metin alanları aranamaz (index: false). Sorgulanması gereken bir alanı text yaparak genişletebilirsiniz.
3.1 Şema v2
Bu şablon Apinizer JSON v2 profilindeki tüm hatlar içindir. Alan listesi, SIEM sayfasındaki Şema v2 bölümüyle aynıdır.
PUT _index_template/apinizer-siem-v2-template
{
"index_patterns": ["apinizer-siem-v2*"],
"data_stream": {},
"priority": 200,
"template": {
"settings": {
"index": {
"lifecycle": { "name": "apinizer-siem-ilm" },
"default_pipeline": "apinizer-siem-timestamp",
"number_of_shards": 1,
"number_of_replicas": 0,
"refresh_interval": "5s"
}
},
"mappings": {
"dynamic_templates": [
{
"strings_as_keyword": {
"match_mapping_type": "string",
"mapping": { "type": "keyword", "ignore_above": 1024 }
}
}
],
"properties": {
"@timestamp": { "type": "date" },
"logType": { "type": "keyword" },
"schemaVersion": { "type": "integer" },
"eventId": { "type": "keyword" },
"timestamp": { "type": "date" },
"correlationId": { "type": "keyword" },
"event": {
"properties": {
"category": { "type": "keyword" },
"action": { "type": "keyword" },
"outcome": { "type": "keyword" },
"severity": { "type": "byte" }
}
},
"actor": {
"properties": {
"user": { "type": "keyword" },
"ip": { "type": "ip", "ignore_malformed": true },
"userAgent": { "type": "keyword", "ignore_above": 1024 },
"sessionId": { "type": "keyword" }
}
},
"target": {
"properties": {
"type": { "type": "keyword" },
"id": { "type": "keyword" },
"name": { "type": "keyword" },
"projectId": { "type": "keyword" },
"projectName": { "type": "keyword" }
}
},
"source": {
"properties": {
"component": { "type": "keyword" },
"host": { "type": "keyword" },
"environmentId": { "type": "keyword" }
}
},
"apinizer": {
"properties": {
"version": { "type": "keyword" },
"configRevision": { "type": "long" },
"destinationId": { "type": "keyword" },
"synthetic": { "type": "boolean" },
"truncated": { "type": "boolean" }
}
},
"data": {
"properties": {
"id": { "type": "keyword" },
"state": { "type": "keyword" },
"origin": { "type": "keyword" },
"changesStatus": { "type": "keyword" },
"changeKinds": { "type": "keyword" },
"changedPaths": { "type": "keyword" },
"changes": { "type": "flattened" },
"reference": { "type": "flattened" },
"reasonCode": { "type": "keyword" },
"errorType": { "type": "keyword" },
"parentErrorType": { "type": "keyword" },
"resultType": { "type": "keyword" },
"message": { "type": "text" },
"loginSource": { "type": "keyword" },
"portalId": { "type": "keyword" },
"accountId": { "type": "keyword" },
"targetAccountId": { "type": "keyword" },
"email": { "type": "keyword" },
"displayName": { "type": "keyword" },
"applicationId": { "type": "keyword" },
"applicationName": { "type": "keyword" },
"environmentName": { "type": "keyword" },
"httpRequestHttpMethod": { "type": "keyword" },
"httpRequestContentType": { "type": "keyword" },
"xForwardedFor": { "type": "keyword" },
"authTokenType": { "type": "keyword" },
"audience": { "type": "keyword" },
"scope": { "type": "keyword" },
"tokenNeverExpires": { "type": "boolean" },
"issuedAt": { "type": "date" },
"expiresAt": { "type": "date" },
"expiresIn": { "type": "long" },
"refreshTokenIssuedAt": { "type": "date" },
"refreshTokenExpiresAt": { "type": "date" },
"refreshTokenExpiresIn": { "type": "long" },
"refreshCount": { "type": "integer" },
"maxRefreshCount": { "type": "integer" },
"level": { "type": "keyword" },
"stackTrace": { "type": "text", "index": false },
"totalDuration": { "type": "integer" },
"date": { "type": "date" },
"statusCode": { "type": "short" },
"protocol": { "type": "keyword" },
"httpMethod": { "type": "keyword" },
"path": { "type": "keyword" },
"latencyMs": { "type": "long" },
"authStatus": { "type": "keyword" },
"authTrustLevel": { "type": "keyword" },
"authFailureCategory": { "type": "keyword" },
"verifiedIssuer": { "type": "keyword" }
}
}
}
}
}
}
source.environmentId Worker UYGULAMA (APPLICATION) olayları için ortam kimliğini, data.environmentName ise ortam adını taşır.