Documentation
¶
Overview ¶
Legacy Elasticsearch writer: it reproduces the flat, pre-restructure index layout — one main file index plus <index>_creds/_urls/_emails/_phone/_document sibling indices whose documents embed file_id/bucket — kept for datasets that were not migrated to the file/leak/reference model implemented in elastic.go.
Every package-level identifier here carries a Legacy marker so both writers can live in the same package; the formatting helpers (fmtInt, fmtRate, renderKVTable) are shared with elastic.go and intentionally not duplicated.
Index ¶
- func NewElasticClient(uri string, debug bool) (*elk.Client, string, error)
- type CsvWriter
- type DbWriter
- type ElasticLegacyWriter
- func (ew *ElasticLegacyWriter) CreateDoc(index string, data []byte, doc_id string) error
- func (ew *ElasticLegacyWriter) CreateDocBulk(index string, docs map[string][]byte) error
- func (ew *ElasticLegacyWriter) CreateIndex(index string, mapping string) error
- func (ew *ElasticLegacyWriter) Finalize() error
- func (ew *ElasticLegacyWriter) Flush() error
- func (ew *ElasticLegacyWriter) Marshal(v any) ([]byte, error)
- func (ew *ElasticLegacyWriter) MarshalAppend(marshalled []byte, new_data map[string]interface{}) ([]byte, error)
- func (ew *ElasticLegacyWriter) Write(result *models.File) error
- type ElasticWriter
- func (ew *ElasticWriter) CreateDoc(index string, data []byte, doc_id string) error
- func (ew *ElasticWriter) CreateIndex(index string, mapping string) error
- func (ew *ElasticWriter) Finalize() error
- func (ew *ElasticWriter) Flush() error
- func (ew *ElasticWriter) Marshal(v any) ([]byte, error)
- func (ew *ElasticWriter) MarshalAppend(marshalled []byte, new_data map[string]interface{}) ([]byte, error)
- func (ew *ElasticWriter) Write(result *models.File) error
- type FinalizableWriter
- type FlushableWriter
- type Interceptor
- type JsonWriter
- type LegacyInterceptor
- type MemoryWriter
- type NoneWriter
- type StdoutWriter
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewElasticClient ¶ added in v0.1.47
NewElasticWriter returns a new Elasticsearch writer. When debug is true, operational logs are emitted at Info level; otherwise they are emitted at Debug level. NewElasticClient builds a client for the cluster addressed by uri and returns it together with the base index name the URI path carries (defaulting to "intelparser"). It only talks to the cluster to ping it, so it is also the way to reach an index that is being read rather than written -- nothing here creates or alters an index.
Types ¶
type CsvWriter ¶
type CsvWriter struct {
FilePath string
// contains filtered or unexported fields
}
CsvWriter writes CSV files
func NewCsvWriter ¶
NewCsvWriter gets a new CsvWriter
type DbWriter ¶
type DbWriter struct {
URI string
ControlOnly bool
ReadOnly bool
// contains filtered or unexported fields
}
DbWriter is a Database writer
func NewDbWriter ¶
NewDbWriter initialises a database writer
type ElasticLegacyWriter ¶ added in v0.1.39
type ElasticLegacyWriter struct {
Client *elk.Client
Index string
// contains filtered or unexported fields
}
JsonWriter is a JSON lines writer
func NewElasticLegacyWriter ¶ added in v0.1.39
func NewElasticLegacyWriter(uri string, debug bool) (*ElasticLegacyWriter, error)
NewElasticLegacyWriter returns a new Elasticsearch writer using the legacy index layout. When debug is true, operational logs are emitted at Info level; otherwise they are emitted at Debug level.
func (*ElasticLegacyWriter) CreateDoc ¶ added in v0.1.39
func (ew *ElasticLegacyWriter) CreateDoc(index string, data []byte, doc_id string) error
func (*ElasticLegacyWriter) CreateDocBulk ¶ added in v0.1.39
func (ew *ElasticLegacyWriter) CreateDocBulk(index string, docs map[string][]byte) error
func (*ElasticLegacyWriter) CreateIndex ¶ added in v0.1.39
func (ew *ElasticLegacyWriter) CreateIndex(index string, mapping string) error
func (*ElasticLegacyWriter) Finalize ¶ added in v0.1.39
func (ew *ElasticLegacyWriter) Finalize() error
Finalize renders a human-friendly end-of-run table with the writer's aggregated ingestion statistics. Safe to call after Flush.
func (*ElasticLegacyWriter) Flush ¶ added in v0.1.39
func (ew *ElasticLegacyWriter) Flush() error
Flush closes the queue and waits for all in-flight writes to complete. Must be called once, after producers have stopped invoking Write.
func (*ElasticLegacyWriter) Marshal ¶ added in v0.1.39
func (ew *ElasticLegacyWriter) Marshal(v any) ([]byte, error)
func (*ElasticLegacyWriter) MarshalAppend ¶ added in v0.1.39
func (ew *ElasticLegacyWriter) MarshalAppend(marshalled []byte, new_data map[string]interface{}) ([]byte, error)
type ElasticWriter ¶
type ElasticWriter struct {
Client *elk.Client
Index string
// contains filtered or unexported fields
}
JsonWriter is a JSON lines writer
func NewElasticWriter ¶
func NewElasticWriter(uri string, debug bool) (*ElasticWriter, error)
func (*ElasticWriter) CreateDoc ¶
func (ew *ElasticWriter) CreateDoc(index string, data []byte, doc_id string) error
func (*ElasticWriter) CreateIndex ¶
func (ew *ElasticWriter) CreateIndex(index string, mapping string) error
func (*ElasticWriter) Finalize ¶ added in v0.1.35
func (ew *ElasticWriter) Finalize() error
Finalize renders a human-friendly end-of-run table with the writer's aggregated ingestion statistics. Safe to call after Flush.
func (*ElasticWriter) Flush ¶ added in v0.1.35
func (ew *ElasticWriter) Flush() error
Flush closes the queue and waits for all in-flight writes to complete. Must be called once, after producers have stopped invoking Write.
func (*ElasticWriter) MarshalAppend ¶
func (ew *ElasticWriter) MarshalAppend(marshalled []byte, new_data map[string]interface{}) ([]byte, error)
type FinalizableWriter ¶ added in v0.1.35
type FinalizableWriter interface {
Finalize() error
}
FinalizableWriter is optionally implemented by writers that can report a final summary after all writes are flushed. The runner calls Finalize once per writer at the end of a run, after Flush. Used (for example) by the Elastic writer to print a table of server-side statistics.
type FlushableWriter ¶ added in v0.1.35
type FlushableWriter interface {
Flush() error
}
FlushableWriter is optionally implemented by writers that buffer work asynchronously. Callers should invoke Flush after all producers have stopped, to drain pending writes before shutdown.
type Interceptor ¶ added in v0.1.25
type Interceptor struct {
// contains filtered or unexported fields
}
type JsonWriter ¶
type JsonWriter struct {
FilePath string
}
JsonWriter is a JSON lines writer
func NewJsonWriter ¶
func NewJsonWriter(destination string) (*JsonWriter, error)
NewJsonWriter return a new Json lines writer
type LegacyInterceptor ¶ added in v0.1.39
type LegacyInterceptor struct {
// contains filtered or unexported fields
}
type MemoryWriter ¶
type MemoryWriter struct {
// contains filtered or unexported fields
}
MemoryWriter is a memory-based results queue with a maximum slot count
func NewMemoryWriter ¶
func NewMemoryWriter(slots int) (*MemoryWriter, error)
NewMemoryWriter initializes a MemoryWriter with the specified number of slots
func (*MemoryWriter) GetAllResults ¶
func (s *MemoryWriter) GetAllResults() []*models.File
GetAllResults returns a copy of all current results.
func (*MemoryWriter) GetFirst ¶
func (s *MemoryWriter) GetFirst() *models.File
GetFirst retrieves the oldest result in the MemoryWriter.
func (*MemoryWriter) GetLatest ¶
func (s *MemoryWriter) GetLatest() *models.File
GetLatest retrieves the most recently added result.
type NoneWriter ¶
type NoneWriter struct {
}
NoneWriter is a None writer
func NewNoneWriter ¶
func NewNoneWriter() (*NoneWriter, error)
NewNoneWriter initialises a none writer
type StdoutWriter ¶
type StdoutWriter struct {
}
StdoutWriter is a Stdout writer
func NewStdoutWriter ¶
func NewStdoutWriter() (*StdoutWriter, error)
NewStdoutWriter initialises a stdout writer