# To generate a bar graph for the given scenario

**URL:** <https://discuss.elastic.co/t/to-generate-a-bar-graph-for-the-given-scenario/222665>\
**Category:** Kibana\
**Created:** [March 9, 2020, 8:16am UTC](https://discuss.elastic.co/t/to-generate-a-bar-graph-for-the-given-scenario/222665 "2020-03-09T08:16:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hari\_Krishna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hari_krishna/32/62678_2.png) [@Hari\_Krishna](https://discuss.elastic.co/u/Hari_Krishna)\
**Post date:** [March 9, 2020, 8:16am UTC](https://discuss.elastic.co/t/to-generate-a-bar-graph-for-the-given-scenario/222665/1 "2020-03-09T08:16:33Z")

</div>

I have a log from which i need to extract the state field and generate a bar graph for the state transitions that the logs have gone through for a given NexthopId. Please help me with this scenario.

**LOGS:**  
2020-03-06 09:36:50.775744749 re0:ndp:25786 lltp\_debug message = "NDP-DBG:NC\_FSM\_HANDLER:1634:: state 4, event 0, NexthopId 44000"  
2020-03-06 09:36:51.548239404 re0:ndp:25786 lltp\_debug message = "NDP-DBG:NC\_FSM\_HANDLER:1634:: state 5, event 3, NexthopId 44001"  
2020-03-06 09:36:52.778379389 re0:ndp:25786 lltp\_debug message = "NDP-DBG:NC\_FSM\_HANDLER:1634:: state 5, event 0, NexthopId 44001"  
2020-03-06 09:36:52.801907464 re0:ndp:25786 lltp\_debug message = "NDP-DBG:NC\_FSM\_HANDLER:1634:: state 7, event 4, NexthopId 44001"

**Here is my logstash config file:**

input {

file {

path =\> ["/home/hari/ndppro/ndp2a.log"]

start\_position =\> "beginning"

sincedb\_path =\> "/dev/null"

}

}

filter {  
grok  
{  
break\_on\_match =\> false  
pattern\_definitions =\> { "mssg" =\> "((Msg|message|Message|message1|message2) [=])" }  
match =\> {  
"message" =\> ["%{TIMESTAMP\_ISO8601:timestamp} %{WORD:node}:%{WORD:program}:%{INT:pid} %{WORD:tracetype}.\*%{mssg} "%{GREEDYDATA:Message}""]  
"Message" =\> ["NexthopId %{WORD:next\_hop\_id}", "state %{WORD:state}", "event %{WORD:event}"]  
}  
}  
mutate  
{  
remove\_field =\> ["message"]  
}

translate {  
field =\> "[state]"  
destination =\> "[state\_name]"  
dictionary =\> {  
"0" =\> "Unknown"  
"1" =\> "No state"  
"2" =\> "Unreachable"  
"3" =\> "Incomplete"  
"4" =\> "Reachable"  
"5" =\> "Stale"  
"6" =\> "Delay"  
"7" =\> "Probe"  
}  
fallback =\> "Invalid state"  
}

translate {  
field =\> "[event]"  
destination =\> "[event\_name]"  
dictionary =\> {  
"0" =\> "NC6\_TIME\_EXP"  
"1" =\> "NC6\_RS\_IN"  
"2" =\> "NC6\_RA\_IN"  
"3" =\> "NC6\_NS\_IN"  
"4" =\> "NC6\_SOL\_NA\_IN"  
"5" =\> "NC6\_UNSL\_NA\_IN"  
"6" =\> "NC6\_NUD\_HINT"  
"7" =\> "NC6\_RT\_ADD"  
"8" =\> "NC6\_RT\_DELETE"  
"9" =\> "NC6\_ND6\_FREE"  
"10" =\> "NC6\_L2IFL\_DOWN"  
"11" =\> "NC6\_MAC\_MOVE"  
"12" =\> "NC6\_IFL\_DOWN"  
"13" =\> "NC6\_RT\_CHANGE\_TO\_TIMER"  
"14" =\> "NC6\_RT\_CHANGE\_TO\_PERM"  
"15" =\> "NC6\_RT\_CHANGE\_MAC"  
"16" =\> "NC6\_PKT\_OUT"  
}  
fallback =\> "Invalid event"  
}

}  
output {  
elasticsearch{  
hosts =\> ["localhost:9200"]  
}  
}

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [March 12, 2020, 3:25pm UTC](https://discuss.elastic.co/t/to-generate-a-bar-graph-for-the-given-scenario/222665/2 "2020-03-12T15:25:36Z")

</div>

Does that ingest script work? What problems are you having?

---

<div class="post-metadata">

**Author:** ![Hari\_Krishna](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hari_krishna/32/62678_2.png) [@Hari\_Krishna](https://discuss.elastic.co/u/Hari_Krishna)\
**Post date:** [March 13, 2020, 4:20am UTC](https://discuss.elastic.co/t/to-generate-a-bar-graph-for-the-given-scenario/222665/3 "2020-03-13T04:20:20Z")

</div>

Hi,

The script works fine. Now i have a scenario where i must generate a graph that shows the state transitions for a given nexthop Id.

I went through kibana visualisation, but i am not able to figure out how to display state transtions.  
Can you please help me out?

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [March 13, 2020, 12:25pm UTC](https://discuss.elastic.co/t/to-generate-a-bar-graph-for-the-given-scenario/222665/4 "2020-03-13T12:25:33Z")

</div>

How does a document look like? It's pretty hard to figure that out from a ingest script.  
Normally you can display the latest value of a document and do a split by term on NexthopId.

---

<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:** [April 10, 2020, 12:25pm UTC](https://discuss.elastic.co/t/to-generate-a-bar-graph-for-the-given-scenario/222665/5 "2020-04-10T12:25:36Z")

</div>

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