<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to create multiple line charts in splunk? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-multiple-line-charts-in-splunk/m-p/444105#M125950</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I have the following data in a dictionary and I would like to create a multi-series  line chart with timestamp X-axis and count on Y-axis and a line chart for each of the keys in the dictionary,I can't seem to figure out how to do this in splunk?&lt;/P&gt;

&lt;P&gt;1.Am I logging in the data in the right formart in splunk?Do I need to change it?&lt;/P&gt;

&lt;P&gt;2.what sort of splunk query should I use to generate this line chart?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;entry = {
    "Analyze.Count":"700",
    "Analyze.Screen":"700",
    "Analyze.Investiage":"701",
    "Analyze.Review":"703",
    "timestamp": int(time.time())  # Can also use datetime.datetime.now().isoformat()
}
requests.post(url="https://endpoint?uat=1&amp;amp;sourcetype=radar_statistics_data2", json=entry)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;EXPECTED OUTPUT:-&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7008iD78E49B911CE178D/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 01 May 2019 02:03:01 GMT</pubDate>
    <dc:creator>isplunk2999</dc:creator>
    <dc:date>2019-05-01T02:03:01Z</dc:date>
    <item>
      <title>How to create multiple line charts in splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-multiple-line-charts-in-splunk/m-p/444105#M125950</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;

&lt;P&gt;I have the following data in a dictionary and I would like to create a multi-series  line chart with timestamp X-axis and count on Y-axis and a line chart for each of the keys in the dictionary,I can't seem to figure out how to do this in splunk?&lt;/P&gt;

&lt;P&gt;1.Am I logging in the data in the right formart in splunk?Do I need to change it?&lt;/P&gt;

&lt;P&gt;2.what sort of splunk query should I use to generate this line chart?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;entry = {
    "Analyze.Count":"700",
    "Analyze.Screen":"700",
    "Analyze.Investiage":"701",
    "Analyze.Review":"703",
    "timestamp": int(time.time())  # Can also use datetime.datetime.now().isoformat()
}
requests.post(url="https://endpoint?uat=1&amp;amp;sourcetype=radar_statistics_data2", json=entry)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;EXPECTED OUTPUT:-&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/7008iD78E49B911CE178D/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 02:03:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-multiple-line-charts-in-splunk/m-p/444105#M125950</guid>
      <dc:creator>isplunk2999</dc:creator>
      <dc:date>2019-05-01T02:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to create multiple line charts in splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-multiple-line-charts-in-splunk/m-p/444106#M125951</link>
      <description>&lt;P&gt;Hi isplunk2999,&lt;/P&gt;

&lt;P&gt;based on your examples you can do it like this :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="{
     \"entry\" : [{
      \"Analyze.Count\":\"700\",
      \"Analyze.Screen\":\"700\",
      \"Analyze.Investiage\":\"701\",
      \"Analyze.Review\":\"703\",
      \"_time\": 1556681125
     }, {
      \"Analyze.Count\":\"800\",
      \"Analyze.Screen\":\"800\",
      \"Analyze.Investiage\":\"801\",
      \"Analyze.Review\":\"803\",
      \"_time\": 1556681325
     }]
 }" 
| spath 
| fields - _raw _time 
| mvexpand entry{}._time 
| rename entry{}.* as * 
| timechart min(*) AS * max(*) AS *
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Everything up until the &lt;CODE&gt;rename&lt;/CODE&gt; is used to create dummy data and the time chart shows it as a chart.&lt;/P&gt;

&lt;P&gt;The important thing for you is to get the data correct on boarded into Splunk as JSON (Hint: &lt;CODE&gt;props.conf&lt;/CODE&gt; using the &lt;CODE&gt;KV_MODE = json&lt;/CODE&gt; option for that sourcetype on your search head), make sure the &lt;CODE&gt;_time&lt;/CODE&gt; is picked up from the JSON field &lt;CODE&gt;timestamp&lt;/CODE&gt; (Hint: again &lt;CODE&gt;props.conf&lt;/CODE&gt; but this time on the parsing Splunk instance &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/Data/Configuretimestamprecognition"&gt;https://docs.splunk.com/Documentation/Splunk/latest/Data/Configuretimestamprecognition&lt;/A&gt; ) and then use a &lt;CODE&gt;timechart&lt;/CODE&gt; on the fields &lt;CODE&gt;entry{}.Analyze*&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS &lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 03:44:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-multiple-line-charts-in-splunk/m-p/444106#M125951</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2019-05-01T03:44:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to create multiple line charts in splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-multiple-line-charts-in-splunk/m-p/444107#M125952</link>
      <description>&lt;P&gt;Hi MuS:&lt;/P&gt;

&lt;P&gt;Few questions&lt;/P&gt;

&lt;P&gt;1.How to make sure the _time is picked up from the JSON field&lt;BR /&gt;&lt;BR /&gt;
  timestamp?should I change the&lt;BR /&gt;&lt;BR /&gt;
  timestamp name to _time ?please&lt;BR /&gt;&lt;BR /&gt;
  advise&lt;BR /&gt;
2. Code I posted is in python,as you can see its already in JSON,you&lt;BR /&gt;&lt;BR /&gt;
  stated"The important thing for you is &lt;BR /&gt;
  to get the data correct on boarded&lt;BR /&gt;&lt;BR /&gt;
  into Splunk as JSON" , are you&lt;BR /&gt;&lt;BR /&gt;
  suggesting to do it any different?&lt;BR /&gt;
3.I tried as below query as you mentioned everything until rename is&lt;BR /&gt;&lt;BR /&gt;
  to create dummy data but it didn't&lt;BR /&gt;&lt;BR /&gt;
  work probably because  of #1 above,&lt;BR /&gt;&lt;BR /&gt;
  please see link&lt;BR /&gt;&lt;BR /&gt;
  &lt;A href="https://imagizer.imageshack.com/img924/663/1Qt9LU.png"&gt;https://imagizer.imageshack.com/img924/663/1Qt9LU.png&lt;/A&gt;&lt;BR /&gt;
         once we fix #1 is the below query the    right one?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"index=indexname sourcetype=radar_statistics_data3 | timechart min(*) AS * max(*) AS *"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;COMMENT UPDATE:&lt;BR /&gt;
1. It sounds like our company splunk instance  assigns timestamp values automatically by using information that it finds in the raw event data&lt;BR /&gt;
2. I think it is already in JSON format&lt;BR /&gt;
3.so what is missing in my query?&lt;/P&gt;

&lt;P&gt;ANOTHER UPDATE:&lt;/P&gt;

&lt;P&gt;I downloaded a local splunk instance and tried your code ,the line graph just shows only the latest element in the list,look at &lt;A href="https://imagizer.imageshack.com/img923/1484/EksD5B.png"&gt;https://imagizer.imageshack.com/img923/1484/EksD5B.png&lt;/A&gt;  and &lt;A href="https://imagizer.imageshack.com/img921/7475/mdvETI.png"&gt;https://imagizer.imageshack.com/img921/7475/mdvETI.png&lt;/A&gt; &lt;/P&gt;

&lt;P&gt;any idea what is wrong?&lt;/P&gt;</description>
      <pubDate>Wed, 01 May 2019 04:45:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-multiple-line-charts-in-splunk/m-p/444107#M125952</guid>
      <dc:creator>isplunk2999</dc:creator>
      <dc:date>2019-05-01T04:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to create multiple line charts in splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-multiple-line-charts-in-splunk/m-p/444108#M125953</link>
      <description>&lt;P&gt;I was able to solve this using following query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=&amp;lt;indexname&amp;gt;  sourcetype=&amp;lt;sourcetype&amp;gt;| chart values(Analyze.Investiaget) as Investigate values(Analyze.Review) as Review values(Analyze.Screent) as Screen over _time
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 May 2019 03:03:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-multiple-line-charts-in-splunk/m-p/444108#M125953</guid>
      <dc:creator>isplunk2999</dc:creator>
      <dc:date>2019-05-03T03:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to create multiple line charts in splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-multiple-line-charts-in-splunk/m-p/444109#M125954</link>
      <description>&lt;P&gt;@isplunk2999 If your problem is resolved, please accept an answer to help future readers.&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 12:58:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-multiple-line-charts-in-splunk/m-p/444109#M125954</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2019-05-03T12:58:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create multiple line charts in splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-multiple-line-charts-in-splunk/m-p/444110#M125955</link>
      <description>&lt;P&gt;@richgalloway - accepeted &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 15:10:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-multiple-line-charts-in-splunk/m-p/444110#M125955</guid>
      <dc:creator>isplunk2999</dc:creator>
      <dc:date>2019-05-03T15:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to create multiple line charts in splunk?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-multiple-line-charts-in-splunk/m-p/444111#M125956</link>
      <description>&lt;P&gt;@richgalloway - accepted &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 15:11:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-multiple-line-charts-in-splunk/m-p/444111#M125956</guid>
      <dc:creator>isplunk2999</dc:creator>
      <dc:date>2019-05-03T15:11:07Z</dc:date>
    </item>
  </channel>
</rss>

