Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/modules/integrations/usecase/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ func (u *moduleUsecase) Create(ctx context.Context, req dto.CreateModuleRequest)
}

if _,err:= u.opensearch.Create(ctx,os_dto.CreateIndexPatternRequest{
Pattern: req.DataType,
PatternModule: &req.ModuleName,
});err!=nil{
//opensearch insertion fails, rolling back database
Expand Down
6 changes: 6 additions & 0 deletions backend/modules/opensearch/usecase/index_pattern.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ func (u *indexPatternUsecase) Create(ctx context.Context, req dto.CreateIndexPat
return nil, errInvalidPattern
}

if !strings.HasPrefix(req.Pattern,constants.CUSTOM_INDEX_PREFIX) {
normalized := strings.ReplaceAll(strings.Trim(strings.ToLower(req.Pattern), ""), " ", "-")
req.Pattern = fmt.Sprintf("%s-%s-*", constants.CUSTOM_INDEX_PREFIX, normalized)
}


p := &domain.UtmIndexPattern{
Pattern: req.Pattern,
PatternModule: req.PatternModule,
Expand Down
42 changes: 35 additions & 7 deletions frontend/src/features/log-explorer/pages/LogExplorerPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,53 @@ import { presetRange } from '@/shared/components/ui/time-range-picker'
import { LogExplorerTabsBar } from '../components/LogExplorerTabsBar'
import { LogExplorerView } from '../components/LogExplorerView'
import { useLogExplorerTabs } from '../hooks/useLogExplorerTabs'
import type { FilterType } from '../types/log-explorer.types'

const TS_FIELD = '@timestamp'

export function LogExplorerPage() {
const location = useLocation()
const navigate = useNavigate()
const tabs = useLogExplorerTabs()
const seededRef = useRef(false)

// Integration "View events" deep-link (?dataType=<value>) → open in a NEW tab.
// Deep-link seed: any query param becomes a filter (?field=value; comma-list
// ?field=a,b,c → IS_ONE_OF_TERMS). Reserved: ?@timestamp=<preset-id> sets the
// range (e.g. 24h, 7d, 30d). No params → normal open, existing tabs shown.
useEffect(() => {
if (seededRef.current) return
const dataType = new URLSearchParams(location.search).get('dataType')
if (!dataType) return
const params = new URLSearchParams(location.search)

let range = presetRange('30d')
const filters: FilterType[] = []
for (const [field, raw] of params.entries()) {
if (field === TS_FIELD) {
range = presetRange(raw)
continue
}
const values = raw.split(',').map((s) => s.trim()).filter(Boolean)
if (values.length === 0) continue
filters.push(
values.length === 1
? { field, operator: 'IS', value: values[0] }
: { field, operator: 'IS_ONE_OF_TERMS', value: values }
)
}

if (filters.length === 0) return

seededRef.current = true
const first = filters[0]
const name =
filters.length === 1
? `${first.field}: ${Array.isArray(first.value) ? first.value.join(',') : String(first.value)}`
: 'Filtered'
tabs.addTab({
name: `dataType: ${dataType}`,
name,
patternStr: 'v11-log-*',
filters: [{ field: 'dataType', operator: 'IS', value: dataType }],
range: presetRange('30d'),
columns: ['dataType'],
filters,
range,
columns: filters.map((f) => f.field),
})
navigate(location.pathname, { replace: true })
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down
10 changes: 9 additions & 1 deletion frontend/src/features/user-auditor/pages/UserAuditorPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,15 @@ function UserDrawer({ user, onClose, t }: { user: ADUser; onClose: () => void; t

<div className="mt-4 flex flex-wrap items-center gap-2">
<Button size="sm" variant="outline" asChild>
<Link to="/log-explorer">
<Link
to={`/log-explorer?${new URLSearchParams({
dataType: 'wineventlog',
tenantId: user.tenantId,
eventCode: '4720,4726,4624',
eventDataTargetSid: user.sid,
'@timestamp': '30d',
}).toString()}`}
>
<ExternalLink size={14} className="mr-1.5" />
{t('userAuditor.drawer.viewInLogs')}
</Link>
Expand Down
Loading