# Is there a way to see the script's console log on observability uptime monitor

**URL:** https://discuss.elastic.co/t/is-there-a-way-to-see-the-scripts-console-log-on-observability-uptime-monitor/320496
**Category:** Synthetics
**Created:** [December 5, 2022, 7:02pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-see-the-scripts-console-log-on-observability-uptime-monitor/320496 "2022-12-05T19:02:29Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![ZaidMomin1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zaidmomin1/32/114250_2.png) [@ZaidMomin1](https://discuss.elastic.co/u/ZaidMomin1)
#### Post date: [December 5, 2022, 7:02pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-see-the-scripts-console-log-on-observability-uptime-monitor/320496/1 "2022-12-05T19:02:30Z")

</div>

Hi,

Hope you're doing well!

We have written the journey for monitoring the web app using playwright and Typescript. We are facing a difficulty to view the script's console.log written with the step, on the uptime monitor.

Do we need to use any other library or method apart of console.log to view the the script logs.

Your help and inputs would be highly appreciated.

Thanks,  
Zaid

---

<div class="post-metadata">

### Author: ![abdulz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abdulz/32/97601_2.png) [@abdulz](https://discuss.elastic.co/u/abdulz)
#### Post date: [December 6, 2022, 5:26pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-see-the-scripts-console-log-on-observability-uptime-monitor/320496/2 "2022-12-06T17:26:11Z")

</div>

Hi Zaid,

Thank you for your post and welcome to the community.

Unfortunately, log statements from journey script aren't captured and reported back, unless if the script throws or breaks due to an error.

What's your use case by the way? If you want to test the journey or test how page behaves against a journey script, you can run the test via `@elastic/synthetics` package via command line locally and can see the log statements in terminal. I am pasting an example below if it helps:

```typescript
// sample-inline-journey.ts
step('Go to home page', async () => {
  await page.goto('https://www.elastic.co');
  const titleElement = await page.locator('h1.title').first().elementHandle();
  const title = await titleElement.innerText();
  console.log(`Title: ${title}`);
  expect(title).toBeTruthy();
});

```

And you can run it in terminal:

```auto
cat <path>/sample-inline-journey.js | npx @elastic/synthetics --inline

```

(you can also append `--no-headless` to view the running test in browser)

It will log:

```auto
Journey: inline
Title: Search. Solve. Succeed.
   ✓ Step: 'Go to home page' succeeded (7663 ms)

 1 passed (9936 ms) 

```

---

<div class="post-metadata">

### Author: ![ZaidMomin1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zaidmomin1/32/114250_2.png) [@ZaidMomin1](https://discuss.elastic.co/u/ZaidMomin1)
#### Post date: [December 7, 2022, 9:17am UTC](https://discuss.elastic.co/t/is-there-a-way-to-see-the-scripts-console-log-on-observability-uptime-monitor/320496/3 "2022-12-07T09:17:00Z")

</div>

Thanks much @abdulz for your inputs.

Running and logging the log statements locally isn't a problem. It's works fine.

We have a a set of scenarios that runs every 10 mins which are monitored and in these scenarios we perform a page load or a button click, (at least 5-6 times and we have written the some useful logs in this logic), if a certain content in iframe isn't loaded --\> We do this because we fetch the iframe content from 3rd party and to avoid false negatives.

On local we cannot really simulate the scenario where the iframe content isn't loading. We ideally play around with locators to check if the iteration logic works fine, which does. But at the run-time we really wanted to capture/see what's happening.

As you said 'log statements from journey script aren't captured and reported back' there's nothing that could be done about it. Despite that, are there any plans to include the log statements from journey script ?

Thanks,  
Zaid

---

<div class="post-metadata">

### Author: ![shahzad31](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shahzad31/32/51637_2.png) [@shahzad31](https://discuss.elastic.co/u/shahzad31)
#### Post date: [December 7, 2022, 1:32pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-see-the-scripts-console-log-on-observability-uptime-monitor/320496/4 "2022-12-07T13:32:05Z")

</div>

@ZaidMomin1 please try to open an enhancement request in [Synthetics](https://github.com/elastic/synthetics/issues/new)  
and we will definitely try to consider it on our roadmap.

---

<div class="post-metadata">

### Author: ![abdulz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abdulz/32/97601_2.png) [@abdulz](https://discuss.elastic.co/u/abdulz)
#### Post date: [December 7, 2022, 2:55pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-see-the-scripts-console-log-on-observability-uptime-monitor/320496/5 "2022-12-07T14:55:50Z")

</div>

> As you said 'log statements from journey script aren't captured and reported back' there's nothing that could be done about it. Despite that, are there any plans to include the log statements from journey script ?

If you must have to collect the output back using the current version, there could be two ways (or say workarounds):

1. Create a webpage accessible in synthetics environment running the test, which accepts the data as URL Query string and print the data in its body. Generate the url when you have the data ready and as a separate journey step, visit that url. You can then use the step screenshot to view that data.
2. Use the [`request`](https://www.elastic.co/guide/en/observability/current/synthetics-create-test.html#synthetics-request-param) object in journey to post the data to some endpoint ([example](https://github.com/elastic/synthetics-demo/blob/main/advanced-examples/journeys/api-requests.journey.ts)).

There are currently no requests or roadmap to collect log statements or custom data points back from journeys. As already suggested, do create an enhancement request. Also, in case you use the above, do mention in the enhancement request if it were useful.

---

<div class="post-metadata">

### Author: ![ZaidMomin1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zaidmomin1/32/114250_2.png) [@ZaidMomin1](https://discuss.elastic.co/u/ZaidMomin1)
#### Post date: [December 8, 2022, 1:17pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-see-the-scripts-console-log-on-observability-uptime-monitor/320496/6 "2022-12-08T13:17:20Z")

</div>

Thanks @shahzad31. As suggested opened an enhancement request.

Request Id: [Enhancement: Capture and report back the log statements from journey script. · Issue #676 · elastic/synthetics · GitHub](https://github.com/elastic/synthetics/issues/676)

---

<div class="post-metadata">

### Author: ![ZaidMomin1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zaidmomin1/32/114250_2.png) [@ZaidMomin1](https://discuss.elastic.co/u/ZaidMomin1)
#### Post date: [December 8, 2022, 1:19pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-see-the-scripts-console-log-on-observability-uptime-monitor/320496/7 "2022-12-08T13:19:37Z")

</div>

Thanks for the workaround, @abdulz We shall think about it.

Your help and inputs are much appreciated.

Thanks,  
Zaid

---

<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: [January 5, 2023, 1:20pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-see-the-scripts-console-log-on-observability-uptime-monitor/320496/8 "2023-01-05T13:20:06Z")

</div>

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