Skip to content

Mocked Data

mocked_data

The Mocked Data adapter generates sample log data locally without requiring any external data source. Use this adapter for testing, learning QQL, or creating demos.

  • Learning: Explore QQL syntax without setting up a backend
  • Demos: Show Cruncher capabilities without production data
  • Testing: Verify queries and configurations before connecting to real data
  • Offline work: No external dependencies or network access needed

The mocked data adapter generates synthetic log records with the following fields:

FieldTypeExample
timestampnumberUnix timestamp in milliseconds
namestring"Alice", "Bob", "Charlie", etc.
agenumberRandom age between 20-80
addressstringRandom street address
tagsstringComma-separated values like "tag1,tag2"
keystringRandom UUID-like identifier
field0 - field9numberRandom numeric fields (0-9) for testing aggregations
{
"timestamp": 1704067200000,
"name": "Alice",
"age": 42,
"address": "123 Main St, Springfield",
"tags": "important,urgent",
"key": "abc-123-def",
"field0": 5,
"field1": 8,
"field2": 3,
...
}

The mocked data adapter requires no parameters:

connectors:
- type: mocked_data
name: test_data

That’s it! Cruncher will automatically generate data when you query this adapter.

where age > 40 | table name, age, address

Display names, ages, and addresses for people over 40.

| stats count, avg(age) by name

Group records by name and show count and average age.

| timechart count by field0

Count records over time, grouped by the field0 numeric value.

where contains(address, "Street") | eval address_upper = upper(address) | table address, address_upper

Find addresses containing “Street” and create an uppercase version.

where age > 30 |
eval age_group = if(age > 60, "senior", "adult") |
stats count, avg(field1) by age_group |
sort -count

Categorize by age group, aggregate, and sort by count.

  • Test QQL: Use mocked data to test complex queries before running them against production
  • Learn functions: Practice with all QQL functions without affecting real data
  • Profile switching: Include the mocked data adapter in a “testing” profile for quick switching

Once you’ve learned QQL with mocked data, connect to real log sources:

For QQL reference, see QQL Documentation.