You're welcome! 😊
Now that you've got a log format like:
User: mdudar (mdudar) Language: en Monitors: Monitor 1: 1920x1080
with label statistics, and it appears every time the user relaunches the application, we can build a dashboard to track user activity, session frequency, and system usage patterns.
✅ Dashboard Goals
We want to:
- Count total app launches over time
- See unique users who use the app
- Track how often each user relaunches the app
- List recent sessions with details (user, language, screen resolution)
🧰 Prerequisites
Make sure your logs are structured or parseable. From the example:
User: mdudar (mdudar) Language: en Monitors: Monitor 1: 1920x1080
We can extract:
username (e.g., mdudar)
language (e.g., en)
- Possibly number of monitors or resolutions
📊 Panel 1: App Launches Over Time (Time Series)
Shows how many times the app was launched per hour/day.
Query:
count_over_time(
{label="statistics"}
|~ "User:.*Language:.*Monitors:"
[1h]
)
Visualization:
- Type: Time series
- Legend:
App Launches
📊 Panel 2: Total Unique Users Over Time
Tracks how many unique users have launched the app over time.
Query:
count by (username) (
{label="statistics"}
|~ "User:.*Language:.*Monitors:"
| regexp "User: (?P<username>\\w+)"
)
Visualization:
- Type: Bar chart or Stat (for current count)
- Legend:
{{username}}
📊 Panel 3: Top Users by Launch Count (Top N)
Who relaunches the app most often?
Query:
topk(10,
count by (username) (
{label="statistics"}
|~ "User:.*Language:.*Monitors:"
| regexp "User: (?P<username>\\w+)"
)
)
Visualization:
- Type: Bar chart or Pie chart
- Legend:
{{username}}
📊 Panel 4: Recent Sessions Table (Raw Log View)
Show the most recent sessions with extracted fields for debugging or analysis.
Query:
{label="statistics"}
|~ "User:.*Language:.*Monitors:"
| regexp "User: (?P<username>\w+) $$(\w+)?$$ Language: (?P<language>\w+) Monitors: (?P<monitors>.*)"
Visualization:
- Type: Table
- Fields to display:
- Time
- username
- language
- monitors
You can also use line_format to beautify:
{label="statistics"}
|~ "User:.*Language:.*Monitors:"
| regexp "User: (?P<username>\w+) $$(\w+)?$$ Language: (?P<language>\w+) Monitors: (?P<monitors>.*)"
| line_format "User: {{.username}}, Language: {{.language}}, Monitors: {{.monitors}}"
Then show as Logs or Table in Grafana.
📊 Panel 5: Language Distribution (Optional)
If you care about localization usage.
Query:
count by (language) (
{label="statistics"}
|~ "User:.*Language:.*Monitors:"
| regexp "Language: (?P<language>\w+)"
)
Visualization:
- Type: Pie chart or Bar chart
🛠️ Final Tips
- Use regex capture groups (
?P<name>) to extract useful info.
- You can extract monitor resolution or number if needed using similar regex.
- If you have multiple usernames with parentheses like
(mdudar), update the regex accordingly:
| regexp "User: (?P<username>\w+) $$?(?P<id>\w+)?$$?"
🎉 Example Dashboard Layout
| Row | Panels |
|---|
| Row 1 | App Launches Over Time (Time series), Total Unique Users (Stat) |
| Row 2 | Top Users by Launches (Bar Chart), Language Usage (Pie Chart) |
| Row 3 | Recent Sessions (Table) |
Let me know if you'd like to add alerts (e.g., notify if no sessions in X hours), or group by day/week/month!
Happy dashboarding! 🚀