# Dashboard creation using Query

**URL:** <https://discuss.elastic.co/t/dashboard-creation-using-query/326647>\
**Category:** Kibana\
**Created:** [February 28, 2023, 5:44am UTC](https://discuss.elastic.co/t/dashboard-creation-using-query/326647 "2023-02-28T05:44:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Haneesha](https://avatars.discourse-cdn.com/v4/letter/h/da6949/32.png) [@Haneesha](https://discuss.elastic.co/u/Haneesha)\
**Post date:** [February 28, 2023, 5:44am UTC](https://discuss.elastic.co/t/dashboard-creation-using-query/326647/1 "2023-02-28T05:44:40Z")

</div>

Hi Team,

We use filebeat, logstash, Elasticsearch and kibana for logs. And we have index patterns created and visualisations and then dashboards.

Now I got a requirement saying to display the replication status that is : Transport lag and Apply lag stats between DC Prod Database and DR Prod (Stand by) Database.

PFB queries to fetch log apply gap and transport/apply lag details -

select Name, value from v$dataguard\_stats where name in ('transport lag','apply lag');  
2.  
select sysdate from dual;  
select primary.thread#,  
primary.maxsequence primaryseq,  
standby.maxsequence standbyseq,  
primary.maxsequence - standby.maxsequence gap  
from ( select thread#, max(sequence#) maxsequence  
from v$archived\_log  
where archived = 'YES'  
and resetlogs\_change# = ( select d.resetlogs\_change# from v$database d )  
group by thread# order by thread# ) primary,  
( select thread#, max(sequence#) maxsequence  
from v$archived\_log  
where applied = 'YES'  
and resetlogs\_change# = ( select d.resetlogs\_change# from v$database d )  
group by thread# order by thread# ) standby  
where primary.thread# = standby.thread#;

---

<div class="post-metadata">

**Author:** ![Venkata\_Raja](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/venkata_raja/32/114264_2.png) [@Venkata\_Raja](https://discuss.elastic.co/u/Venkata_Raja)\
**Post date:** [February 28, 2023, 6:13am UTC](https://discuss.elastic.co/t/dashboard-creation-using-query/326647/2 "2023-02-28T06:13:54Z")

</div>

Hi , Are we loading this query result in some index?

---

<div class="post-metadata">

**Author:** ![Haneesha](https://avatars.discourse-cdn.com/v4/letter/h/da6949/32.png) [@Haneesha](https://discuss.elastic.co/u/Haneesha)\
**Post date:** [February 28, 2023, 6:27am UTC](https://discuss.elastic.co/t/dashboard-creation-using-query/326647/3 "2023-02-28T06:27:48Z")

</div>

No actually these queries are taken from a dataguard DB table. As per my knowledge, we have to create a comf file and then store there.

But don't know how to proceed.

---

<div class="post-metadata">

**Author:** ![Venkata\_Raja](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/venkata_raja/32/114264_2.png) [@Venkata\_Raja](https://discuss.elastic.co/u/Venkata_Raja)\
**Post date:** [February 28, 2023, 6:35am UTC](https://discuss.elastic.co/t/dashboard-creation-using-query/326647/4 "2023-02-28T06:35:50Z")

</div>

Try logstash JDBC filter to load these queries data into a index

---

<div class="post-metadata">

**Author:** ![Haneesha](https://avatars.discourse-cdn.com/v4/letter/h/da6949/32.png) [@Haneesha](https://discuss.elastic.co/u/Haneesha)\
**Post date:** [February 28, 2023, 7:49am UTC](https://discuss.elastic.co/t/dashboard-creation-using-query/326647/5 "2023-02-28T07:49:53Z")

</div>

Here in [type] what should be kept. What will be the if condition. Could you please tell.

if [type] == "link" {  
elasticsearch{  
hosts =\> "localhost:9200"  
index =\> "dblink-%{+YYYY.MM.dd}"  
}

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 28, 2023, 7:49am UTC](https://discuss.elastic.co/t/dashboard-creation-using-query/326647/6 "2023-03-28T07:49:53Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
